Skip to content

Commit 3641fd6

Browse files
committed
Add test for subsystem
1 parent c930116 commit 3641fd6

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

test/test_subsystem.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
from scorep import subsystem
3+
4+
5+
def test_reset_preload(monkeypatch):
6+
monkeypatch.setenv('LD_PRELOAD', '/some/value')
7+
# Nothing changes if the var is not present
8+
monkeypatch.delenv('SCOREP_LD_PRELOAD_BACKUP', raising=False)
9+
subsystem.reset_preload()
10+
assert os.environ['LD_PRELOAD'] == '/some/value'
11+
12+
# Variable set -> Update
13+
monkeypatch.setenv('SCOREP_LD_PRELOAD_BACKUP', '/new/value')
14+
subsystem.reset_preload()
15+
assert os.environ['LD_PRELOAD'] == '/new/value'
16+
17+
# Variable empty -> remove
18+
monkeypatch.setenv('SCOREP_LD_PRELOAD_BACKUP', '')
19+
subsystem.reset_preload()
20+
assert 'LD_PRELOAD' not in os.environ

0 commit comments

Comments
 (0)