After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684956 - Test programs shall report pass/fail with exit status
Test programs shall report pass/fail with exit status
Status: RESOLVED FIXED
Product: libsigc++
Classification: Bindings
Component: tests
2.2.x
Other All
: Normal minor
: ---
Assigned To: libsigc++ maintainer(s)
libsigc++ maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-09-27 14:13 UTC by Kjell Ahlstedt
Modified: 2012-10-18 13:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch: Improve some test cases. (30.20 KB, patch)
2012-09-27 14:26 UTC, Kjell Ahlstedt
none Details | Review

Description Kjell Ahlstedt 2012-09-27 14:13:56 UTC
Most of the test programs in libsigc++2/tests print a lot of text and exit with
exit status 0 unconditionally. This is not how test programs executed by
'make check' shall behave. Preferably they shall not print anything if the test
passes. More importantly their exit status shall not be 0 if the test fails.
Comment 1 Kjell Ahlstedt 2012-09-27 14:26:27 UTC
Created attachment 225263 [details] [review]
patch: Improve some test cases.

This patch shows how the test cases test_accum_iter, test_accumulated and
test_cpp11_lambda can be improved. (test_cpp11_lambda was fairly good. It's
only slightly improved.)

I'll leave the patch here for others to comment on it. If it's accepted, or I
get no comments within a week or two, I will push it, and probably later change
more test cases.
Comment 2 Kjell Ahlstedt 2012-10-18 13:29:16 UTC
I've changed all test cases in the master branch.

What was previously written to std::cout is now written to an
std::ostringstream, and compared with the expected results. I have tested with
gcc 4.6.3 and gcc 4.7.2 on a PC with Ubuntu 12.04. I've assumed that the
results of all test cases except test_size are implementation-independent.
If this assumption is wrong, 'make check' will fail with another compiler
and/or another type of processor. I don't expect that to happen, but I can't
rule it out.