Commit Graph

309 Commits

Author SHA1 Message Date
Nick Mathewson 9dddfe83f3 Several mingw/msvc/cross-compilation fixes
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-26 18:36:25 -04:00
George Kadianakis b80728a115 tor_vsscanf(): Don't return -1 if '%%' doesn't match.
tor_vsscanf() is supposed to return the current number of matches on
match failure.
2012-04-03 16:20:24 +02:00
Nick Mathewson 88caa552cc Fix a couple of "unused assigned value" warnings in parse_config tests
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-30 10:26:34 -04:00
Sebastian Hahn 77bc1b803e Fix a bunch of check-spaces complaints 2012-03-28 15:02:15 +02:00
Nick Mathewson de0dca0de7 Refactor the API for setting up a block cipher.
It allows us more flexibility on the backend if the user needs to
specify the key and IV at setup time.
2012-03-27 22:37:56 -04:00
Nick Mathewson 00b4784575 Remove support for PK_NO_PADDING in crypto_pk_public_hybrid_encrypt
We never use it, and it would be a stupid thing if we started using it.
2012-03-27 22:37:55 -04:00
Nick Mathewson 342e753d31 Merge remote-tracking branch 'karsten/bug5053' 2012-03-27 11:22:32 -04:00
Sebastian Hahn 582f747049 Provide large enough buffer in test_util_sscanf()
This was causing crashes during unit test runs, as stack smashing
protections got triggered. Issue spotted by weasel
2012-03-27 15:16:22 +02:00
Nick Mathewson c4bfc7ca0e Disable some tor_sscanf tests that gcc says are illegal formats 2012-03-08 21:16:46 -05:00
Nick Mathewson 97b15e6fb0 Fix new strcmp_opt/len tests on OSs where strcmp() can return values >1 or <-1 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez 998891e734 Add unit tests for path_is_relative 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez dbd170f752 Some more corner cases for tor_sscanf 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez 8e88377905 expand_filename tests for trailing slash in $HOME 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez 043e154cdd Add some tests for expand_filename 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez 6beec6a373 Add two small tests for tor_sscanf 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez fa4ca5ddc1 Add test for broken escapes in parse_config_... 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez 8bb68011f0 Add some unit tests for parse_iso_time 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez c097401879 Add tests for string_is_C_identifier 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez 1f6e3ec500 Improve coverage in string-related unit tests 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez 03258529d8 Improve coverage in time-related unit tests 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez a3679d30c0 Remove unreliable assertion
* 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-08 20:49:26 -05:00
Esteban Manchado Velázquez 8d62e42fd3 Add extra tests for wrap_string 2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez 9ae7d511f4 Add extra tests for get_parent_directory 2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez fa1d6f812c Tweak test case text so it's clearer 2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez 4beebea698 Improve eat_whitespace* unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez 3e4a977781 Put expected first in n_bits_set_u8 unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez afb89b83f2 Improve tor_split_lines unit tests
* Add some more test cases
* Switch to test_assert et al
2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez 699af29bae Use test_streq in join_win_cmdline unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez 7b8a7556a8 Use test_eq et al in spawn_background unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez 6b3854f8a3 Use test_streq in format_helper_exit_status tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez 22a915bcd2 Improve get_parent_directory unit tests
* Add more test cases to the get_parent_directory tests
* Switch the parameter order so that the expected value is the first one
2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez 275b81ec5d Improve listdir unit tests 2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez 667f30e465 Improve a bit asprintf unit tests 2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez 781c6676ca Rewrite the find_str_at_start_of_line unit tests 2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez 667f5ea409 Improve/extend strtok_r unit tests
* Add several failing tests (embedded in an "#if 0" block) for behaviour that
  doesn't match strtok_r
* Add another, passing, more interesting test
* Use test_eq_ptr(NULL, ...) instead of test_assert(NULL == ...)
2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez ee317256bb Improve tor_sscanf tests
* Add many new test cases, tweak/improve existing ones, reorganize them a bit
* Switch the parameters in all test_eq calls so the expected value is the first
* Change all the "r = tor_sscanf(...);\ntest_eq(1, r)" to the more compact
  "test_eq(1, tor_sscanf(...))". It may be a tiny bit harder to find the
  tor_sscanf calls (it's the long lines anyway), but it saves a lot of lines,
  which should help readability.
2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez 4e44024ced Improve test case for read_escaped_data unit test 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez 3c5a3b33e8 Trivial readability changes in mmap unit tests 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez f90406cb01 Clean up and improve gzip unit tests
* Switch some test_eq parameters so the expected is always the first parameter
* Drop some manual checks of compressed format magic numbers (they're pointless
  and they make the unit tests less readable and more fragile, considering
  we're already indirectly checking those magic numbers via the
  detect_compression_method function)
* Add a couple of extra assertions
2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez f4242d2e4a Add/improve the rest of the strmisc tests 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez 14177f03a9 Improve tor_snprintf tests 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez 314c851bc2 Add/improve tests for str{,case}cmp{start,end} 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez f11be57860 Add more/better tests in test_util_strmisc 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez 73d9868232 Trivial cosmetic fix in test comments 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez ab39382cf8 Organize test_util_time in blocks
* Separate the tests for different functions with a comment
* Move some test init code further down, closer to where it was actually being
  used
2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez f81af6d791 Add test for comments in the config parser 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez 5a206dbb7a Remove duplicated macro definition 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez f9ad35c361 Add test for broken hex parsing
* The test currently fails, but it's commented out (with an "#if 0")
* As a broken octal actually gives a parse error, it seems fair that this
  fails, too
2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez 72d455b5eb Improve config parser escaped content tests 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez 4d9dda9bb9 Add tests for escaped content in config 2012-03-08 20:49:17 -05:00