I made a somewhat silly assumption when writing the group_manager, that all Test classes would use list arguments. While this assumption is true for tests that require an entire command as their first argument it isn't true of GleanTest, where only the name of the subtest is passed. In this case it will be a string, and if a name isn't passed as well then name will end up being " ".join()'ed, ie, "api" -> "a p i".
This patch adds support to the group_manager to support this feature. I considered two other approaches here. The first was to say screw correctness, and just add a duplicate name to the handful of tests that use the group_manager. The second was to change GleanTest to take a 1 element list. Both of these had downsides that I couldn't justify. Signed-off-by: Dylan Baker <[email protected]> --- Michel, does this fix your problem? framework/profile.py | 17 +++++++++++++---- framework/tests/profile_tests.py | 11 +++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index e8e8ba1..e125a67 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -322,11 +322,20 @@ class TestProfile(object): constructor as keyword args. """ + # If there is no name, then either + # a) join the arguments list together to make the name + # b) use the argument string as the name + # The former is used by the Piglit{G,C}LTest classes, the latter by + # GleanTest if not name: - lgroup = grouptools.join(group, ' '.join(args)) - else: - assert isinstance(name, basestring) - lgroup = grouptools.join(group, name) + if isinstance(args, list): + name = ' '.join(args) + else: + assert isinstance(args, basestring) + name = args + + assert isinstance(name, basestring) + lgroup = grouptools.join(group, name) self.test_list[lgroup] = test_class( args, diff --git a/framework/tests/profile_tests.py b/framework/tests/profile_tests.py index d2878c3..96337c6 100644 --- a/framework/tests/profile_tests.py +++ b/framework/tests/profile_tests.py @@ -33,6 +33,7 @@ import framework.dmesg as dmesg import framework.profile as profile from framework.tests import utils from framework import grouptools +from framework.test import GleanTest # Don't print sys.stderr to the console sys.stderr = sys.stdout @@ -241,3 +242,13 @@ def test_testprofile_groupmanager_kwargs_overwrite(): test = prof.test_list[grouptools.join('foo', 'a')] nt.assert_equal(test.run_concurrent, False) + + +def test_testprofile_groupmanager_name_str(): + """TestProfile.group_manager: if args is a string it is not joined.""" + prof = profile.TestProfile() + # Yes, this is really about supporting gleantest anyway. + with prof.group_manager(GleanTest, 'foo') as g: + g('abc') + + nt.ok_('foo/abc' in prof.test_list) -- 2.3.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
