summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
AgeCommit message (Collapse)Author
2012-07-17Change all SMARTLIST_FOREACH loops of >=10 lines to use BEGIN/ENDNick Mathewson
The SMARTLIST_FOREACH macro is more convenient than BEGIN/END when you have a nice short loop body, but using it for long bodies makes your preprocessor tell the compiler that all the code is on the same line. That causes grief, since compiler warnings and debugger lines will all refer to that one line. So, here's a new style rule: SMARTLIST_FOREACH blocks need to be short.
2012-06-26Merge remote-tracking branch 'public/bug6227' into maint-0.2.3Nick Mathewson
2012-06-26Add a unit test for environment_variable_names_equalNick Mathewson
I need this because I'm about to frob that function to stop using strcspn() in order to get rid of a clang warning.
2012-06-25Bump the test util/threads timeout up to 150 secNick Mathewson
This should make some debian build systems happier. Also, increase the select() timeout to a more reasonable 100 msec.
2012-06-23Resolve crash caused by format_helper_exit_status changes in #5557Nick Mathewson
Because the string output was no longer equal in length to HEX_ERRNO_SIZE, the write() call would add some extra spaces and maybe a NUL, and the NUL would trigger an assert in get_string_from_pipe. Fixes bug 6225; bug not in any released version of Tor.
2012-06-22Add unit test for format_hex_number_for_helper_exit_status()Andrea Shepard
2012-06-22Make format_helper_exit_status() avoid unnecessary spacesAndrea Shepard
2012-06-07Fix mingw build with -DUNICODE -D_UNICODENick Mathewson
This is a very blunt fix, and mostly just turns some func() calls into FuncA() to make things build again. Fixes bug 6097.
2012-06-05Fix some mingw build warningsNick Mathewson
These include: - Having a weird in_addr that can't be initialized with {0} - Needing INVALID_HANDLE_VALUE instead of -1 for file handles. - Having a weird dependent definition for struct stat. - pid is signed, not unsigned.
2012-06-04Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson
2012-06-04Fix build warning on Lenny about strtok_r unit testNick Mathewson
This fixes a warning in efb8a09f, where Debain Lenny's GCC doesn't get that for (i=0; i<3; ++i) { const char *p; switch(i) { case 0: p="X"; break; case 1: p="Y"; break; case 2: p="Z"; break; } printf("%s\n", p); } will never try to print an uninitialezed value. Found by buildbots. Bug in no released versions of Tor.
2012-05-31Merge remote-tracking branch 'public/bug5089'Nick Mathewson
Conflicts: src/test/test_util.c Merge the unit tests; I added some when I did this branch against 0.2.2, and then the test format changed and master added more tests.
2012-05-31A few more get_parent_directory tests.Nick Mathewson
2012-05-24Have get_parent_directory() handle "/foo" and "/" correctly.Nick Mathewson
The parent of "/foo" is "/"; and "/" is its own parent. This would cause Tor to fail if you tried to have a PF_UNIX control socket in the root directory. That would be a stupid thing to do for other reasons, but there's no reason to fail like _this_. Bug found by Esteban Manchado Velázquez. Fix for bug 5089; bugfix on Tor 0.2.2.26-beta. Unit test included.
2012-05-16Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2012-05-16Make the succeeding parse_http_time tests more obviously rightNick Mathewson
(When the correct answer is given in terms of seconds since the epoch, it's hard to be sure that it really is the right answer just by reading the code.)
2012-05-16Fix month check in parse_http_time, add testSebastian Hahn
2012-05-16Reject an additional type of bad date in parse_http_timeNick Mathewson
2012-05-16Fix parse_http_time and add testsEsteban Manchado Velázquez
* It seems parse_http_time wasn't parsing correctly any date with commas (RFCs 1123 and 850). Fix that. * It seems parse_http_time was reporting the wrong month (they start at 0, not 1). Fix that. * Add some tests for parse_http_time, covering all three formats.
2012-05-16Fix some remaining nmake/msvc build issuesNick Mathewson
2012-05-11Fix a couple of wide linesNick Mathewson
2012-05-11Merge remote-tracking branch 'public/bug5091'Nick Mathewson
2012-05-10Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/common/util.c src/test/test_util.c
2012-05-07Handle out-of-range values in tor_parse_* integer functionsNick Mathewson
The underlying strtoX functions handle overflow by saturating and setting errno to ERANGE. If the min/max arguments to the tor_parse_* functions are equal to the minimum/maximum of the underlying type, then with the old approach, we wouldn't treat a too-large value as genuinely broken. Found this while looking at bug 5786; bugfix on 19da1f36 (in Tor 0.0.9), which introduced these functions.
2012-04-26Several mingw/msvc/cross-compilation fixesNick Mathewson
They boil down to: - MS_WINDOWS is dead and replaced with _WIN32, but we let a few instances creep in when we merged Esteban's tests. - Capitalizing windows header names confuses mingw. - #ifdef 0 ain't C. - One unit test wasn't compiled on windows, but was being listed anyway. - One unit test was checking for the wrong value. Gisle Vanem found and fixed the latter 3 issues.
2012-04-03tor_vsscanf(): Don't return -1 if '%%' doesn't match.George Kadianakis
tor_vsscanf() is supposed to return the current number of matches on match failure.
2012-03-30Fix tor_strtok_r_impl and test cases per bug #5091nils
== Nick here. I tweaked this patch a little to make it apply cleanly to master, to extract some common code into a function, and to replace snprintf with tor_snprintf. -- nickm
2012-03-30Fix a couple of "unused assigned value" warnings in parse_config testsNick Mathewson
Coverity doesn't like the fact that we were storing the value of parse_config_line_from_str() but not checking it in a couple of cases. Fixes CID 505 and 506.
2012-03-28Fix a bunch of check-spaces complaintsSebastian Hahn
2012-03-27Provide large enough buffer in test_util_sscanf()Sebastian Hahn
This was causing crashes during unit test runs, as stack smashing protections got triggered. Issue spotted by weasel
2012-03-08Disable some tor_sscanf tests that gcc says are illegal formatsNick Mathewson
2012-03-08Fix new strcmp_opt/len tests on OSs where strcmp() can return values >1 or <-1Nick Mathewson
2012-03-08Add unit tests for path_is_relativeEsteban Manchado Velázquez
2012-03-08Some more corner cases for tor_sscanfEsteban Manchado Velázquez
2012-03-08expand_filename tests for trailing slash in $HOMEEsteban Manchado Velázquez
2012-03-08Add some tests for expand_filenameEsteban Manchado Velázquez
2012-03-08Add two small tests for tor_sscanfEsteban Manchado Velázquez
2012-03-08Add test for broken escapes in parse_config_...Esteban Manchado Velázquez
2012-03-08Add some unit tests for parse_iso_timeEsteban Manchado Velázquez
2012-03-08Add tests for string_is_C_identifierEsteban Manchado Velázquez
2012-03-08Improve coverage in string-related unit testsEsteban Manchado Velázquez
2012-03-08Improve coverage in time-related unit testsEsteban Manchado Velázquez
2012-03-08Remove unreliable assertionEsteban Manchado Velázquez
* This assertion fails when executing the whole suite, but not when executing this test by itself * Ideally I'd prefer starting with a guaranteed empty directory, but it's not very important in this case as non-existence of other paths is being checked explicitly
2012-03-08Add extra tests for wrap_stringEsteban Manchado Velázquez
2012-03-08Add extra tests for get_parent_directoryEsteban Manchado Velázquez
2012-03-08Tweak test case text so it's clearerEsteban Manchado Velázquez
2012-03-08Improve eat_whitespace* unit testsEsteban Manchado Velázquez
2012-03-08Put expected first in n_bits_set_u8 unit testsEsteban Manchado Velázquez
2012-03-08Improve tor_split_lines unit testsEsteban Manchado Velázquez
* Add some more test cases * Switch to test_assert et al
2012-03-08Use test_streq in join_win_cmdline unit testsEsteban Manchado Velázquez