From a061646f3a87e9e3729b4ac1f4dee2a88d0c8f5b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 25 Nov 2018 13:26:30 +0100 Subject: Test fast model serialisation --- wscript | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/wscript b/wscript index 6dfadcd5..8d62382e 100644 --- a/wscript +++ b/wscript @@ -426,6 +426,16 @@ def get_resources_with_type(model, rdf_class): tests += [s] return tests +def option_combinations(options): + "Return an iterator that cycles through all combinations of the given options" + import itertools + + thru_options = [] + for n in range(len(options) + 1): + thru_options += list(itertools.combinations(options, n)) + + return itertools.cycle(thru_options) + def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): import itertools @@ -452,12 +462,8 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): if len(tests) == 0: return - thru_flags = ['-e', '-b', '-r http://example.org/'] - thru_options = [] - for n in range(len(thru_flags) + 1): - thru_options += list(itertools.combinations(thru_flags, n)) - thru_options_iter = itertools.cycle(thru_options) - + extra_options_iter = option_combinations(['-f']) + thru_options_iter = option_combinations(['-e', '-b', '-r http://example.org/']) quiet = not Options.options.verbose_tests tests_name = '%s.%s' % (testdir, test_class[test_class.find('#') + 1:]) with autowaf.begin_tests(ctx, APPNAME, tests_name): @@ -467,8 +473,9 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''): rel_action = os.path.join(os.path.relpath(srcdir), action) abs_action = os.path.join(srcdir, action) uri = base_uri + os.path.basename(action) - command = 'serdi_static -a %s %s "%s" > %s' % ( - options, rel_action, uri, action + '.out') + command = 'serdi_static -a %s %s %s "%s" > %s' % ( + options, ' '.join(next(extra_options_iter)), + rel_action, uri, action + '.out') # Run strict test result = run_test(command, expected_return, action, quiet=quiet) -- cgit v1.2.1