aboutsummaryrefslogtreecommitdiffstats
path: root/LICENSE
diff options
context:
space:
mode:
authorRomain Geissler <romain.geissler@amadeus.com>2020-03-11 22:30:20 +0000
committerRomain Geissler <romain.geissler@amadeus.com>2020-03-11 22:39:20 +0000
commita1b0173df92bbbad69254f929e341f8dbf1cc708 (patch)
treea9250c6dfa08a770fef5c1f0c472a6036371347d /LICENSE
parente588eb1ff9ff6598666279b737b27f983156ad85 (diff)
downloadgoogletest-a1b0173df92bbbad69254f929e341f8dbf1cc708.tar.gz
googletest-a1b0173df92bbbad69254f929e341f8dbf1cc708.tar.bz2
googletest-a1b0173df92bbbad69254f929e341f8dbf1cc708.zip
Make sure IsATTY does not clobber errno.
Exposition of the problem: > cat main.cpp TEST(errnoTest, errnoTest) { ASSERT_EQ(errno, 0); } int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Compiled with gcc 10 like this: > g++ -pthread -o runtest main.cpp -Wl,-Bstatic -lgtest -Wl,-Bdynamic Before patch: > ./runtest [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest [ OK ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. (output is colored, I run this inside an interactive terminal). > ./runtest | cat [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest main.cpp:5: Failure Expected equality of these values: (*__errno_location ()) Which is: 25 0 [ FAILED ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] errnoTest.errnoTest 1 FAILED TEST (output is not colored, since IsTTY return false, because of the pipe, however it also clobbered errno for the tests). After the patch, both cases are working fine: > ./runtest [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest [ OK ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. > ./runtest | cat [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from errnoTest [ RUN ] errnoTest.errnoTest [ OK ] errnoTest.errnoTest (0 ms) [----------] 1 test from errnoTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test.
Diffstat (limited to 'LICENSE')
0 files changed, 0 insertions, 0 deletions