Commit Graph

27 Commits

Author SHA1 Message Date
Steven Murdoch 06eafb3fcc Fix running unit tests from outside of the build directory (fixes bug #2051)
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-11 23:29:52 +01:00
Nick Mathewson 544a8afe5a Merge remote branch 'sjmurdoch/bug1903' 2010-10-11 11:01:15 -04:00
Steven Murdoch f7338d3baa Skip running fgets_eagain test until we fix it 2010-10-11 15:56:14 +01:00
Nick Mathewson 8f76f31761 Make tor_sscanf handle %x 2010-10-11 10:50:47 -04:00
Steven Murdoch 8a12ce2cf9 Add a unit test for tor_spawn_background
- Test sucessfully starting a process
- Test failing to find the executable
2010-10-10 19:08:44 +01:00
Steven Murdoch 8ee559bd63 Add a unit test for fgets (currently fails)
- For a non-blocking pipe, check that on EAGAIN fgets returns NULL
  rather than a partial line
2010-10-10 19:08:44 +01:00
Steven Murdoch 5a77c64834 Fix issues in nickm's review of format_helper_exit_status for bug #1903
- Responsibility of clearing hex_errno is no longer with caller
- More conservative bounds checking
- Length requirement of hex_errno documented
- Output format documented
2010-10-04 14:31:27 +01:00
Steven Murdoch a6dc00fa75 Start tor-fw-helper in the background, and log whatever it outputs 2010-09-30 11:40:37 -04:00
Nick Mathewson e385961542 Merge remote branch 'public/bug1954' into maint-0.2.2 2010-09-27 15:39:40 -04:00
Sebastian Hahn 1d29ad891e Add new torrc line continuation unit tests
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-23 22:46:13 +02:00
Nick Mathewson 418e6caeeb New function to load windows system libraries
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-21 14:39:23 -04:00
Sebastian Hahn a05ef55b66 Allow comments for multi-line torrc options 2010-09-11 01:41:23 +02:00
Nick Mathewson 07049b3d25 Support mutli-line torrc options via the usual backslash syntax 2010-09-10 09:19:10 -04:00
Nick Mathewson 34551cda6f Add unit test for tor_listdir. 2010-08-20 13:24:54 -04:00
Sebastian Hahn 0bfa34e1f6 Create control.h 2010-07-27 07:58:15 +02:00
Sebastian Hahn c4f8f1316e Create config.h 2010-07-27 07:58:14 +02:00
Nick Mathewson 7221d15acc Merge commit 'origin/maint-0.2.1'
Conflicts:
	src/or/test.c
2010-04-12 18:22:06 -04:00
Nick Mathewson 927425150b Merge branch 'asprintf' 2010-04-02 12:30:46 -04:00
Nick Mathewson da220157a9 Update copyright dates for files not in maint-0.2.1 2010-02-27 17:19:00 -05:00
Nick Mathewson 6fa8dacb97 Add a tor_asprintf() function, and use it in a couple of places.
asprintf() is a GNU extension that some BSDs have picked up: it does a printf
into a newly allocated chunk of RAM.

Our tor_asprintf() differs from standard asprintf() in that:
  - Like our other malloc functions, it asserts on OOM.
  - It works on windows.
  - It always sets its return-field.
2010-02-25 16:09:10 -05:00
Nick Mathewson df3812ede1 Rearrange _thread_test_func to please Coverity Scan
I believe  that since  we were allocating  *cp while holding  a mutex,
coverity deduced that  *cp must be protected by  that mutex, and later
flipped out  when we didn't  use it  that way. If  this is so,  we can
solve our problems by moving the *cp = tor_strdup(buf) part outside of
the mutex-protected code.
2010-01-25 14:12:37 -05:00
Karsten Loesing f80672d747 Remove duplicate words and a duplicate newline. 2009-12-18 12:55:05 +01:00
Nick Mathewson 235f1e1a96 Refactor out the 'find string at start of any line' logic.
We do this in too many places throughout the code; it's time to start
clamping down.

Also, refactor Karsten's patch to use strchr-then-strndup, rather than
malloc-then-strlcpy-then-strchr-then-clear.
2009-12-17 18:29:37 -05:00
Nick Mathewson 134ac8059b Fix the very noisy unit test memory leak of CID 420-421.
On any failing case in test_util_config_line, we would leak a couple
of strings.
2009-10-26 22:40:41 -04:00
Nick Mathewson fa693118b1 Split directory tests into their own module.
(Also, clean up some whitespace.)
2009-09-23 00:24:43 -04:00
Nick Mathewson 050545405a Split test_util() into smaller functions. 2009-09-23 00:24:43 -04:00
Nick Mathewson d9d0813809 Split general util and address tests into their own files. 2009-09-23 00:24:43 -04:00