summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
AgeCommit message (Collapse)Author
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-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-18Complete logging of output from port forwarding helperSteven Murdoch
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-06-08Prefer tt_assert in unit tests, not tor_assertNick Mathewson
2011-06-08Fix a minor coverity-found bug in testsSebastian Hahn
2011-05-15Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-05-15Add a function to pull off the final component of a pathNick Mathewson
2011-05-15Fixup whitespace issues from 3122 commit in 0.2.3Nick Mathewson
2011-05-11Merge remote-tracking branch 'public/bug3122_memcmp_022' into bug3122_memcmp_023Nick Mathewson
Conflicts in various places, mainly node-related. Resolved them in favor of HEAD, with copying of tor_mem* operations from bug3122_memcmp_022. src/common/Makefile.am src/or/circuitlist.c src/or/connection_edge.c src/or/directory.c src/or/microdesc.c src/or/networkstatus.c src/or/router.c src/or/routerlist.c src/test/test_util.c
2011-05-11fwd-port test_util_di_ops into tinytest formatNick Mathewson
2011-05-04Use read_all() to read messages from spawn_backgroundNick Mathewson
Using read() is an invitation to get some of the data you want, not all. Possible fix for bug 2462
2011-01-03Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
2011-01-03Merge remote branch 'sebastian/bug2314' into maint-0.2.2Nick Mathewson
2011-01-03Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
2011-01-03Bump copyright statements to 2011 (0.2.2)Nick Mathewson
2010-12-27Fix compile wanrings revealed by gcc 4.5 on mingwSebastian Hahn
2010-10-11Fix running unit tests from outside of the build directory (fixes bug #2051)Steven Murdoch
Currently the unit tests test_util_spawn_background_* assume that they are run from the Tor build directory. This is not the case when running make distcheck, so the test will fail. This problem is fixed by autoconf setting BUILDDIR to be the root of the Tor build directory, and this preprocessor variable being used to specify the absolute path to test-child. Also, in test-child, do not print out argv[0] because this will no longer be predictable. Found by Sebastian Hahn.
2010-10-11Merge remote branch 'sjmurdoch/bug1903'Nick Mathewson
2010-10-11Skip running fgets_eagain test until we fix itSteven Murdoch
2010-10-11Make tor_sscanf handle %xNick Mathewson
2010-10-10Add a unit test for tor_spawn_backgroundSteven Murdoch
- Test sucessfully starting a process - Test failing to find the executable
2010-10-10Add a unit test for fgets (currently fails)Steven Murdoch
- For a non-blocking pipe, check that on EAGAIN fgets returns NULL rather than a partial line
2010-10-04Fix issues in nickm's review of format_helper_exit_status for bug #1903Steven Murdoch
- Responsibility of clearing hex_errno is no longer with caller - More conservative bounds checking - Length requirement of hex_errno documented - Output format documented
2010-09-30Start tor-fw-helper in the background, and log whatever it outputsSteven Murdoch
2010-09-27Merge remote branch 'public/bug1954' into maint-0.2.2Nick Mathewson
2010-09-23Add new torrc line continuation unit testsSebastian Hahn
We want to make sure that we don't break old torrc files that might have used something like this made-up example: ContactInfo UberUser <uber@user.com> # /// Fake email! \\\ Log info file /home/nick.mathewson/projects/tor-info.log And we also want to support the following style of writing your torrc: ExcludeNodes \ # Node1337 is run by the Bavarian Illuminati Node1337, \ # The operator of Node99 looked at me funny Node99 The code already handles both cases, but the unit test should help prove it.
2010-09-21New function to load windows system librariesNick Mathewson
This function uses GetSystemDirectory() to make sure we load the version of the library from c:\windows\system32 (or local equivalent) rather than whatever version lives in the cwd.
2010-09-11Allow comments for multi-line torrc optionsSebastian Hahn
2010-09-10Support mutli-line torrc options via the usual backslash syntaxNick Mathewson
2010-08-20Add unit test for tor_listdir.Nick Mathewson
2010-07-27Create control.hSebastian Hahn