summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2011-09-09Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: configure.in src/or/circuitbuild.c
2011-09-01Handle test case where fgets() sees EOF on the last readSteven Murdoch
On some platforms, with non-blocking IO, on EOF you first get EAGAIN, and then on the second read you get zero bytes and EOF is set. However on others, the EOF flag is set as soon as the last byte is read. This patch fixes the test case in the latter scenario.
2011-09-01Fix double-closing a stdio streamSteven Murdoch
After a stream reached eof, we fclose it, but then test_util_spawn_background_partial_read() reads from it again, which causes an error and thus another fclose(). Some platforms are fine with this, others (e.g. debian-sid-i386) trigger a double-free() error. The actual code used by Tor (log_from_pipe() and tor_check_port_forwarding()) handle this case correctly.
2011-08-31Tweaks on last process-launch patchesNick Mathewson
2011-09-01Make a version of tor_read_all_handle() for non-Windows platformsSteven Murdoch
Mainly used for testing reading from subprocesses. To be more generic we now pass in a pointer to a process_handle_t rather than a Windows- specific HANDLE.
2011-08-31Fix off-by-one error when allocating memory in test_util_split_lines()Steven Murdoch
Triggered "failed OVER picket-fence magic-number check (err 27)" when memory debugging using dmalloc is enabled (at 'low' or higher).
2011-08-30Use %f with printf-style formatting, not %lfNick Mathewson
For printf, %f and %lf are synonymous, since floats are promoted to doubles when passed as varargs. It's only for scanf that we need to say "%lf" for doubles and "%f" for floats. Apparenly, some older compilers think it's naughty to say %lf and like to spew warnings about it. Found by grarpamp.
2011-08-30Rename tor_join_cmdline to tor_join_win_cmdline; tweak doxygenNick Mathewson
2011-08-30Factor out and re-write code for splitting lines from a handleSteven Murdoch
Now handles non-printable characters and will not output a spurious new-line if given a partial line.
2011-08-29Refactor out command line formattingSteven Murdoch
Now correctly handles whitespace, quotes and backslashes. Passes all unit tests.
2011-08-29Replace two magic tristates with #define'd namesSteven Murdoch
- process_handle_t.status - return value of tor_get_exit_code()
2011-08-28Make signature of tor_spawn_background more conventionalSteven Murdoch
Conventionally in Tor, structs are returned as pointers, so change tor_spawn_background() to return the process handle in a pointer rather than as return value.
2011-08-24Appease "make check-spaces"Steven Murdoch
2011-08-24We don't need to find our own path, just tell Windows to searchSteven Murdoch
2011-08-24Find test-child.exe by looking in same directory as test.exeSteven Murdoch
2011-08-22Fix test cases to handle MSYS style paths (/c/foo rather than c:/foo)Steven Murdoch
Also fix test case to expect 1 on successfully spawning a subprocess
2011-08-22Tidy up subprocess codeSteven Murdoch
- Better error handling - Write description of functions - Don't assume non-negative process return values
2011-08-22Fix some compiler warningsSteven Murdoch
2011-08-18Merge remote branch 'origin/master' into bug2046Steven Murdoch
2011-08-18Complete logging of output from port forwarding helperSteven Murdoch
2011-08-04Clean up bridge-stats code.Karsten Loesing
Only write a bridge-stats string if bridge stats have been initialized. This behavior is similar to dirreq-stats, entry-stats, etc. Also add a few unit tests for the bridge-stats code.
2011-08-04Separate generation of an entry-stats string from writing it to disk.Karsten Loesing
This commit is similar to the previous two commits for dirreq-stats, but for entry-stats.
2011-08-04Separate generation of a dirreq-stats string from writing it to disk.Karsten Loesing
This patch separates the generation of a dirreq-stats string from actually writing it to disk. The new geoip_format_dirreq_stats() generates a dirreq-stats string that geoip_dirreq_stats_write() writes to disk. All the state changing (e.g., resetting the dirreq-stats history and initializing the next measurement interval) takes place in geoip_dirreq_stats_write(). That allows us to finally test the dirreq-stats code better.
2011-08-04Add unit tests for buffer-stats.Karsten Loesing
Now that formatting the buffer-stats string is separate from writing it to disk, we can also decouple the logic to extract stats from circuits and finally write some unit tests for the history code.
2011-07-25Test case for reading the partial output of a background processSteven Murdoch
2011-07-22Use PeekNamedPipe to avoid blocking ReadFile when there is nothing to readSteven Murdoch
2011-07-22Add code to read all from a handle, but this block foreverSteven Murdoch
See http://stackoverflow.com/questions/3722409/windows-child-process-with-redirected-input-and-output for a potential solution
2011-07-21Add Windows version of tor_spawn_background and ancillary functionsSteven Murdoch
2011-07-21Generalize process spawning so its test compiles (but fails) in WindowsSteven Murdoch
- pid, stdout/stderr_pipe now encapsulated in process_handle - read_all replaced by tor_read_all_from_process_stdin/stderr - waitpid replaced by tor_get_exit_code Untested on *nix
2011-07-20Unit test for generic_buffer_set_to_copyNick Mathewson
2011-07-15Remove compare_addr_to_addr_policyNick Mathewson
Nothing used it but the unit tests; everything else knows to use compare_tor_addr_to_addr_policy instead.
2011-07-13Merge remote-tracking branch 'public/bug1666'Nick Mathewson
Conflicts: doc/spec/socks-extensions.txt src/or/buffers.c src/or/config.c src/or/connection_edge.c
2011-07-01Check return value of crypto_global_init in test.cNick Mathewson
This will let the unit tests fail in a less mystifying way if the crypto subsystem is b0rken, and will also make Coverity happier. CID # 429.
2011-06-29Refactor fetch_from_buf_socks() to be greedyNick Mathewson
Previously, fetch_from_buf_socks() might return 0 if there was still data on the buffer and a subsequent call to fetch_from_buf_socks() would return 1. This was making some of the socks5 unit tests harder to write, and could potentially have caused misbehavior with some overly verbose SOCKS implementations. Now, fetch_from_buf_socks() does as much processing as it can, and returns 0 only if it really needs more data. This brings it into line with the evbuffer socks implementation.
2011-06-29Refactor socks unit tests into a suite of their ownNick Mathewson
2011-06-29Record username/password data in socks_request_tNick Mathewson
This change also requires us to add and use a pair of allocator/deallocator functions for socks_request_t, instead of using tor_malloc_zero/tor_free directly.
2011-06-29Fix 'make check-spaces'Nick Mathewson
2011-06-22Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-06-22Fix minor comment issuesRobert Ransom
2011-06-22Fix comment typoRobert Ransom
2011-06-14Make the get_options() return constNick Mathewson
This lets us make a lot of other stuff const, allows the compiler to generate (slightly) better code, and will make me get slightly fewer patches from folks who stick mutable stuff into or_options_t. const: because not every input is an output!
2011-06-14Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-06-09Upgrade to the latest version of tinytestNick Mathewson
2011-06-08Prefer tt_assert in unit tests, not tor_assertNick Mathewson
2011-06-08Check some more return values in unit testsSebastian Hahn
2011-06-08Fix a minor coverity-found bug in testsSebastian Hahn
2011-06-03Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-06-03Reject 128-byte keys that are not 1024-bitNick Mathewson
When we added the check for key size, we required that the keys be 128 bytes. But RSA_size (which defers to BN_num_bytes) will return 128 for keys of length 1017..1024. This patch adds a new crypto_pk_num_bits() that returns the actual number of significant bits in the modulus, and uses that to enforce key sizes. Also, credit the original bug3318 in the changes file.
2011-05-28Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-05-23Fix GCC 4.6's new -Wunused-but-set-variable warnings.Nick Mathewson
Most instances were dead code; for those, I removed the assignments. Some were pieces of info we don't currently plan to use, but which we might in the future. For those, I added an explicit cast-to-void to indicate that we know that the thing's unused. Finally, one was a case where we were testing the wrong variable in a unit test. That one I fixed. This resolves bug 3208.