mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Change the data validation tests to take the directory instead of files
Instead of passing a million files, let's pass the directory and do a pathlib glob instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
import argparse
|
||||
import configparser
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
|
||||
@@ -220,8 +221,8 @@ def parse_data_file(path):
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Device data-file checker")
|
||||
parser.add_argument('file', nargs='+')
|
||||
parser.add_argument("directory")
|
||||
args = parser.parse_args()
|
||||
for path in args.file:
|
||||
for path in pathlib.Path(args.directory).glob("*.device"):
|
||||
validate_data_file_name(path)
|
||||
parse_data_file(path)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import configparser
|
||||
|
||||
@@ -40,11 +41,11 @@ def parse_data_file(path):
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Device duplicate match checker')
|
||||
parser.add_argument('file', nargs='+')
|
||||
parser.add_argument("directory")
|
||||
args = parser.parse_args()
|
||||
device_matches = {}
|
||||
duplicates = False
|
||||
for path in args.file:
|
||||
for path in pathlib.Path(args.directory).glob("*.device"):
|
||||
matches = parse_data_file(path)
|
||||
fname = os.path.basename(path)
|
||||
for m in matches:
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import configparser
|
||||
|
||||
@@ -61,10 +62,10 @@ def parse_data_file(path):
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Checks that no unifying receiver ID is in the device files')
|
||||
parser.add_argument('file', nargs='+')
|
||||
parser.add_argument("directory")
|
||||
args = parser.parse_args()
|
||||
receiver_found = False
|
||||
for path in args.file:
|
||||
for path in pathlib.Path(args.directory).glob("*.device"):
|
||||
matches = parse_data_file(path)
|
||||
fname = os.path.basename(path)
|
||||
for m in matches:
|
||||
|
||||
@@ -371,13 +371,13 @@ install_data(data_files,
|
||||
install_dir : join_paths(get_option('datadir'), 'libratbag'))
|
||||
|
||||
data_parse_test = find_program(join_paths(meson.source_root(), 'data/devices/data-parse-test.py'))
|
||||
test('data-parse-test', data_parse_test, args: data_files)
|
||||
test('data-parse-test', data_parse_test, args: 'data/devices')
|
||||
|
||||
duplicate_test = find_program(join_paths(meson.source_root(), 'data/devices/duplicate-check.py'))
|
||||
test('duplicate-test', duplicate_test, args : data_files)
|
||||
test('duplicate-test', duplicate_test, args : 'data/devices')
|
||||
|
||||
reciever_id_test = find_program(join_paths(meson.source_root(), 'data/devices/receiver-check.py'))
|
||||
test('receiver-id-test', reciever_id_test, args : data_files)
|
||||
test('receiver-id-test', reciever_id_test, args : 'data/devices')
|
||||
|
||||
#### tests ####
|
||||
enable_tests = get_option('tests')
|
||||
|
||||
Reference in New Issue
Block a user