1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00

Merge pull request #7416 from keszybz/readd-lost-test

Readd lost test
This commit is contained in:
Lennart Poettering 2017-11-22 17:24:21 +01:00 committed by GitHub
commit 0a5b5115b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 15 deletions

View File

@ -1218,6 +1218,7 @@ subdir('src/sulogin-shell')
subdir('src/boot/efi')
subdir('src/test')
subdir('rules')
subdir('test')
############################################################
@ -2345,7 +2346,6 @@ subdir('units')
subdir('sysctl.d')
subdir('sysusers.d')
subdir('tmpfiles.d')
subdir('rules')
subdir('hwdb')
subdir('network')
subdir('man')

View File

@ -41,6 +41,8 @@ rules = files('''
install_data(rules,
install_dir : udevrulesdir)
all_rules = rules
rules_in = '''
50-udev-default.rules
64-btrfs.rules
@ -54,4 +56,5 @@ foreach file : rules_in
configuration : substs)
install_data(gen,
install_dir : udevrulesdir)
all_rules += gen
endforeach

View File

@ -188,6 +188,13 @@ endif
############################################################
rule_syntax_check_py = find_program('rule-syntax-check.py')
test('rule-syntax-check',
rule_syntax_check_py,
args : all_rules)
############################################################
if conf.get('HAVE_SYSV_COMPAT') == 1
sysv_generator_test_py = find_program('sysv-generator-test.py')
test('sysv-generator-test',

View File

@ -24,17 +24,9 @@ import sys
import os
from glob import glob
if len(sys.argv) > 1:
# explicit rule file list
rules_files = sys.argv[1:]
else:
# take them from the build dir
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
rules_dir = os.path.join(os.environ.get('top_srcdir', root_dir), 'rules')
if not os.path.isdir(rules_dir):
sys.stderr.write('No rules files given, and %s does not exist, aborting' % rules_dir)
sys.exit(2)
rules_files = glob(os.path.join(rules_dir, '*.rules'))
rules_files = sys.argv[1:]
if not rules_files:
sys.exit('Specify files to test as arguments')
no_args_tests = re.compile(r'(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
args_tests = re.compile(r'(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
@ -44,6 +36,7 @@ args_assign = re.compile(r'(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)
result = 0
buffer = ''
for path in rules_files:
print('# looking at {}'.format(path))
lineno = 0
for line in open(path):
lineno += 1
@ -66,9 +59,9 @@ for path in rules_files:
if not (no_args_tests.match(clause) or args_tests.match(clause) or
no_args_assign.match(clause) or args_assign.match(clause)):
print('Invalid line %s:%i: %s' % (path, lineno, line))
print(' clause: %s' % clause)
print('')
print('Invalid line {}:{}: {}'.format(path, lineno, line))
print(' clause:', clause)
print()
result = 1
break