Bug 41020

Summary: cairo-test-suite crashes when using CAIRO_TESTS
Product: cairo Reporter: S Boucher <stbya>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch for the reported crash

Description S Boucher 2011-09-19 13:56:15 UTC
Created attachment 51372 [details] [review]
patch for the reported crash

Essentially, append_argv in cairo-test-suite.c cannot work.

Attached is a patch for test/cairo-test-suite.c, as well as a fix for test/README, and changes to test/Makefile.am to have a more useful behavior in the case of failures (having make exit with 0, when the compilation fails is not good).
Comment 1 Chris Wilson 2011-09-19 14:34:40 UTC
commit 572479ec20c967f91c22a4e49e705c105d37a1dc
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date:   Fri Sep 9 14:16:21 2011 -0300

    test/README: add missing "S"
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

commit 669242c2c8009b2a257131ba1a3cf497b9472cc4
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date:   Fri Sep 9 14:14:48 2011 -0300

    test: fix append_argv()
    
    When I ran "CAIRO_TESTS=a1-bug make test", no test executed because of a
    bug in append_argv(). The "olen" variable was assuming that we always
    only append a single argument to argv and the resulting argc was also
    wrong.
    
    Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

And I think we should probably remove make test/retest given that none of the core developers use it as far as I know.
Comment 2 S Boucher 2011-09-21 08:19:05 UTC
Strictly speaking, the description of the bug in commit 669242c2c8009b2a257131ba1a3cf497b9472cc4 is wrong.

append_argv doesn't assume that only 1 arg is appended.  It doesn't even correctly append a single arg, as Paulo points out with his example: "CAIRO_TESTS=a1-bug make test".

The +1 is there to have a argv[argc] == NULL, as far as I can tell.

All in all, it probably would have been clearer in the first place to have:

char** get_test_lists(int argc, char **argv, const char *env_tests_string)

and adjust main() accordingly.  Overriding argv seems too clever.

But this nitpicking aside. If make test/make retest isn't used, it would be nice to know how core developpers prefer to run tests.  It's helpful for those (like me) that arrive out of the blue to look at cairo, and try to figure out how things come together.
Comment 3 Chris Wilson 2011-09-21 08:49:13 UTC
I use (and I think so my fellow conspirators) make [dist]check for running package wide tests, but for most of my debugging I use:

  CAIRO_TEST_TARGET=<target> ./cairo-test-suite <test-case>

along with gdb/valgrind variations of the same.

But don't let me stop you from offering patches to improve the code! :)
Comment 4 GitLab Migration User 2018-08-25 13:57:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/288.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.