Add some rudimentary test selection support

develop
lethosor 2020-04-01 02:15:27 -04:00
parent fa1da3d9de
commit ba72497963
2 changed files with 14 additions and 0 deletions

@ -242,6 +242,17 @@ function main()
end
print('Filtering tests')
if config.tests then
local orig_length = #tests
for i = #tests, 1, -1 do
for _, pattern in pairs(config.tests) do
if not tests[i].name:match(pattern) then
table.remove(tests, i)
end
end
end
print('Selected tests: ' .. #tests .. '/' .. orig_length)
end
local status = load_test_status() or {}
for i = #tests, 1, -1 do
local test = tests[i]

@ -17,6 +17,8 @@ parser.add_argument('--no-quit', action='store_true',
help='Do not quit DF when done')
parser.add_argument('--test-dir', '--test-folder',
help='Base test folder (default: df_folder/test)')
parser.add_argument('-t', '--test', dest='tests', nargs='+',
help='Test(s) to run (Lua patterns accepted)')
args = parser.parse_args()
if (not sys.stdin.isatty() or not sys.stdout.isatty() or not sys.stderr.isatty()) and not args.headless:
@ -77,6 +79,7 @@ test_config_file = 'test_config.json'
with open(test_config_file, 'w') as f:
json.dump({
'test_dir': args.test_dir,
'tests': args.tests,
}, f)
try: