File: test.py

package info (click to toggle)
alire 1.2.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 13,124 kB
  • sloc: ada: 77,497; python: 6,605; sh: 477; ansic: 347; makefile: 258; javascript: 87; xml: 40
file content (48 lines) | stat: -rw-r--r-- 1,637 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Test the fidelity of various logging scopes
"""

from glob import glob

from drivers.alr import run_alr
from drivers.asserts import assert_eq
from drivers.asserts import assert_match

# Check invalid syntax detection
p = run_alr('-d--', complain_on_error=False, quiet=False)
assert p.status == 1, "alr should have error code 1"
assert_eq('Filtering mode: BLACKLIST\n'
          'Invalid logging scope separator: --\n'
          'ERROR: Invalid logging filters.',
          p.out.strip())

# Check empty whitelist lets nothing through
p = run_alr('-vv', '-d+', 'dev', quiet=False)
assert_eq('Filtering mode: WHITELIST', p.out.strip())

# Check whitelisting
p = run_alr('-vv', '-d+dev', 'dev', '--filter', quiet=False)
assert_match('Filtering mode: WHITELIST\n'
             'Filtering substring: dev\n'
             '\[Alr.Commands.Dev.Execute\] \(alr-commands-dev.adb:[0-9]* \)'
             ' -->> In dev --filter',
             p.out.strip())

# Check whitelisting with exception
p = run_alr('-vv', '-d+dev-exec', 'dev', '--filter', quiet=False)
assert_eq('Filtering mode: WHITELIST\n'
          'Filtering substring: dev\n'
          'Filtering exception: exec',
          p.out.strip())

# Check blacklisting with exception
p = run_alr('-vv', '-d-a+main', 'dev', quiet=False)
assert_match('Filtering mode: BLACKLIST\n'
             'Filtering substring: a\n'
             'Filtering exception: main\n'
             '\[Alr.Main                \] \(alr-main.adb:.*',
             # Remaining output is likely to change in the future so lets just
             # stop here the matching.
             p.out.strip())

print('SUCCESS')