curl-library
[PATCH v2 0/3] runtests.pl: Fix LD_PRELOAD with ASAN libs
Date: Mon, 17 Nov 2014 18:06:23 +0100
Hi,
This is the second revision of the earlier patchset[1] which fixes tests
which broke when ran under LD_PRELOAD=libhostname.so with ASAN enabled
(cmake without CURLDEBUG). To facilitate that change, it was necessary
to change from a command string to a list of command arguments.
About the patches:
The first patch ("runtests.pl: reduce shell usage, fixing LD_PRELOAD")
actually contains three changes:
- Convert from shell commands to an array of arguments.
- Implement a subset of IPC::Run as AIX does not have this module.
- Implement a custom subroutine that splits a shell command into an
array. This is done because Text::ParseWords is broken and does not
handle some cases correctly.
While the diffstat looks large (+303/-120), most of the additions are
just the two IPC::Run and Text::ParseWord replacements (+98/-17) and
reformatting of the callers (string concat to a list of arguments).
The second patch further restricts the scope of environment variables to
avoid calling GDB with LD_PRELOAD for example.
The third patch fixes the return value of tests ran under GDB to avoid
failure when a test expects a non-zero exit code.
Changes since v1[1] and v2:
- Renamed patch subject "simplify command environment handling" to
"reduce shell usage, fixing LD_PRELOAD" such that the goal is
emphasized.
- Fixed wrong variable in the Text::ParseWords replacement, resulting
in an empty value.
- Fixed IPC::Run replacement, now a pipe is used to pass stdout/stderr
into a variable.
- Fixed issue where tests which need stdin data failed when ran under
GDB. Consequence of the fix is that tests which need both LD_PRELOAD
and stdin data will fail to run when built with ASAN.
- Add a new patch to fix the return value of GDB for tests expecting a
non-zero return value (new feature!).
If you would like to test these patches, or would like to view a repo
otherwise, a copy of these patches are located at
https://github.com/Lekensteyn/curl/compare/master...fix-tests
(https://github.com/Lekensteyn/curl/compare/62a6230...35f04a7)
I have already put some effort in testing these changes on a single
system and think that these are ready for merging. Reviews and testing
are appreciated!
For reference, these are my test results:
- Build environment: Arch Linux x86_64, GCC 4.9.1.
- (autotools) ../configure --enable-debug --enable-curldebug
CFLAGS='-fsanitize=undefined -fsanitize=address'
LDFLAGS='-fsanitize=undefined -fsanitize=address'
- (cmake) cmake /tmp/curl -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_FLAGS='-fsanitize=address -fsanitize=undefined -Wall'
# autotools, fix-tests branch, curl-7_39_0-111-g35f04a7
TESTDONE: 922 tests out of 922 reported OK: 100%
TESTDONE: 955 tests were considered during 464 seconds.
TESTINFO: 33 tests were skipped due to these restraints:
TESTINFO: "Resolving IPv6 'ip6-localhost' didn't work" 2 times (241, 1083)
TESTINFO: "openssl engine not supported" 1 times (307)
TESTINFO: "configured as DISABLED" 8 times (594, 836, 882, 938, 1209, 1211, 1316, 1512)
TESTINFO: "failed starting HTTP-pipe server" 4 times (1900, 1901, 1902, 1903)
TESTINFO: "curl lacks Metalink support" 18 times (2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 and 9 more)
# autotools, master branch, curl-7_39_0-108-g62a6230
TESTDONE: 922 tests out of 922 reported OK: 100%
TESTDONE: 955 tests were considered during 463 seconds.
TESTINFO: 33 tests were skipped due to these restraints:
TESTINFO: "openssl engine not supported" 1 times (307)
TESTINFO: "curl lacks Metalink support" 18 times (2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 and 9 more)
TESTINFO: "configured as DISABLED" 8 times (594, 836, 882, 938, 1209, 1211, 1316, 1512)
TESTINFO: "failed starting HTTP-pipe server" 4 times (1900, 1901, 1902, 1903)
TESTINFO: "Resolving IPv6 'ip6-localhost' didn't work" 2 times (241, 1083)
(did not die because this is a debug build, and LD_PRELOAD got skipped)
# cmake, fix-tests branch, curl-7_39_0-111-g35f04a7
TESTDONE: 821 tests out of 821 reported OK: 100%
TESTDONE: 955 tests were considered during 403 seconds.
TESTINFO: 134 tests were skipped due to these restraints:
TESTINFO: "openssl engine not supported" 1 times (307)
TESTINFO: "curl lacks unittest support" 16 times (1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308 and 7 more)
TESTINFO: "curl lacks TrackMemory support" 2 times (96, 558)
TESTINFO: "curl lacks debug support" 76 times (67, 68, 69, 81, 89, 90, 91, 150, 155 and 67 more)
TESTINFO: "configured as DISABLED" 8 times (594, 836, 882, 938, 1209, 1211, 1316, 1512)
TESTINFO: "curl lacks NTLM_WB support" 1 times (1310)
TESTINFO: "curl lacks large_file support" 3 times (99, 1044, 1063)
TESTINFO: "curl lacks TLS-SRP support" 5 times (320, 321, 322, 323, 324)
TESTINFO: "failed starting HTTP-pipe server" 4 times (1900, 1901, 1902, 1903)
TESTINFO: "Resolving IPv6 'ip6-localhost' didn't work" 2 times (241, 1083)
TESTINFO: "curl lacks Metalink support" 16 times (2005, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 and 7 more)
# cmake, master branch, curl-7_39_0-108-g62a6230
TESTDONE: 804 tests out of 804 reported OK: 100%
TESTDONE: 955 tests were considered during 413 seconds.
TESTINFO: 151 tests were skipped due to these restraints:
TESTINFO: "Resolving IPv6 'ip6-localhost' didn't work" 2 times (241, 1083)
TESTINFO: "precheck command error" 17 times (831, 834, 877, 880, 933, 936, 2023, 2024, 2025 and 8 more)
TESTINFO: "curl lacks large_file support" 3 times (99, 1044, 1063)
TESTINFO: "openssl engine not supported" 1 times (307)
TESTINFO: "curl lacks TLS-SRP support" 5 times (320, 321, 322, 323, 324)
TESTINFO: "failed starting HTTP-pipe server" 4 times (1900, 1901, 1902, 1903)
TESTINFO: "curl lacks Metalink support" 16 times (2005, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 and 7 more)
TESTINFO: "curl lacks TrackMemory support" 2 times (96, 558)
TESTINFO: "curl lacks unittest support" 16 times (1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308 and 7 more)
TESTINFO: "configured as DISABLED" 8 times (594, 836, 882, 938, 1209, 1211, 1316, 1512)
TESTINFO: "curl lacks NTLM_WB support" 1 times (1310)
TESTINFO: "curl lacks debug support" 76 times (67, 68, 69, 81, 89, 90, 91, 150, 155 and 67 more)
(precheck failed here because LD_PRELOAD interfered)
Kind regards,
Peter
[1]: http://curl.haxx.se/mail/lib-2014-11/0213.html
Peter Wu (3):
runtests.pl: reduce shell usage, fixing LD_PRELOAD
runtests.pl: simplify command environment handling
runtests.pl: use exit code of child for gdb
tests/runtests.pl | 493 ++++++++++++++++++++++++++++++++++++------------------
1 file changed, 331 insertions(+), 162 deletions(-)
-- 2.1.2 ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2014-11-17