Esteban Manchado Velázquez
57a4e07665
Add quoted content tests for the config parser
2012-03-08 20:49:16 -05:00
Patrick Mézard
857ae345c8
Fix off-by-one error in test_util_make_environment
2012-02-20 14:12:50 +01:00
Robert Ransom
773290c09a
Add unit tests for easily tested, non-trivial utility functions
2012-02-17 11:42:21 -05:00
Nick Mathewson
5cf9167f91
Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32
...
This commit is completely mechanical; I used this perl script to make it:
#!/usr/bin/perl -w -i.bak -p
if (/^\s*\#/) {
s/MS_WINDOWS/_WIN32/g;
s/\bWIN32\b/_WIN32/g;
}
2012-01-31 15:48:47 -05:00
Nick Mathewson
26e789fbfd
Rename nonconformant identifiers.
...
Fixes bug 4893.
These changes are pure mechanical, and were generated with this
perl script:
/usr/bin/perl -w -i.bak -p
s/crypto_pk_env_t/crypto_pk_t/g;
s/crypto_dh_env_t/crypto_dh_t/g;
s/crypto_cipher_env_t/crypto_cipher_t/g;
s/crypto_digest_env_t/crypto_digest_t/g;
s/aes_free_cipher/aes_cipher_free/g;
s/crypto_free_cipher_env/crypto_cipher_free/g;
s/crypto_free_digest_env/crypto_digest_free/g;
s/crypto_free_pk_env/crypto_pk_free/g;
s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g;
s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g;
s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g;
s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g;
s/crypto_new_cipher_env/crypto_cipher_new/g;
s/crypto_new_digest_env/crypto_digest_new/g;
s/crypto_new_digest256_env/crypto_digest256_new/g;
s/crypto_new_pk_env/crypto_pk_new/g;
s/crypto_create_crypto_env/crypto_cipher_new/g;
s/connection_create_listener/connection_listener_new/g;
s/smartlist_create/smartlist_new/g;
s/transport_create/transport_new/g;
2012-01-18 15:53:30 -05:00
Nick Mathewson
f729e1e984
Merge branch 'feature3457-v4-nm-squashed'
...
Conflicts:
src/or/rendclient.c
2012-01-11 12:10:14 -05:00
Nick Mathewson
b5af456685
Use spaceless ISO8601 time format, not sec,usec.
2012-01-11 12:08:01 -05:00
Peter Palfrader
f6b19ac79c
test_util_spawn_background_ok: fix expectation
...
test_util_spawn_background_ok() hardcoded the expected value
for ENOENT to 2. This isn't portable as error numbers are
platform specific, and particularly the hurd has ENOENT at
0x40000002.
Construct expected string at runtime, using the correct value
for ENOENT (closes : #4733 ).
2011-12-17 12:21:51 -05:00
Nick Mathewson
d106caaadc
Add an initializer to appease older gcc
2011-11-30 18:08:07 -05:00
Nick Mathewson
e83862a0ff
Resolve a resource leak in test_util_split_lines
...
Fixes coverity CID # 488
2011-11-30 12:16:08 -05:00
Nick Mathewson
d6c18c5804
Make process_handle_t private and fix some unit tests
...
Let's *not* expose more cross-platform-compatibility structures, or
expect code to use them right.
Also, don't fclose() stdout_handle and stdin_handle until we do
tor_process_handle_destroy, or we risk a double-fclose.
2011-11-25 16:47:25 -05:00
Gisle Vanem
af12a7ac00
Fix test_util.c compilation on MSVC
...
"Those '{}' constructs are not well liked by MSVC (cl v.16.xx)."
Received on tor-dev; fixes bug on 0.2.3.3-alpha.
2011-11-11 23:49:53 -05:00
Anders Sundman
8d6ce1625f
Unit tests for eat_whitespace functions
2011-11-10 23:26:39 +01:00
Anders Sundman
c0efd461d3
Unit test for n_bits_set func
2011-11-10 23:26:39 +01:00
Anders Sundman
fa9aef6eec
Unit test for hex_str func
...
Note: Too long input is undefined by contract. That behaviour should not be asserted in test.
2011-11-10 23:26:29 +01:00
Nick Mathewson
ed39621a9d
Merge remote-tracking branch 'asn2/bug3656'
...
Conflicts:
src/common/util.c
src/common/util.h
src/or/config.h
src/or/main.c
src/test/test_util.c
2011-10-07 16:05:13 -04:00
Steven Murdoch
f5df96c94f
Handle test case where fgets() sees EOF on the last read
...
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-01 18:17:54 +01:00
Steven Murdoch
cfa9ee5fe7
Fix double-closing a stdio stream
...
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-09-01 14:15:54 +01:00
Nick Mathewson
6a3e4a89a2
Tweaks on last process-launch patches
2011-08-31 22:14:38 -04:00
Steven Murdoch
5b8a20ed44
Make a version of tor_read_all_handle() for non-Windows platforms
...
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-09-01 01:43:44 +01:00
Steven Murdoch
76fde28475
Fix off-by-one error when allocating memory in test_util_split_lines()
...
Triggered "failed OVER picket-fence magic-number check (err 27)" when
memory debugging using dmalloc is enabled (at 'low' or higher).
2011-08-31 23:40:29 +01:00
Nick Mathewson
2778cdd671
Rename tor_join_cmdline to tor_join_win_cmdline; tweak doxygen
2011-08-30 16:00:08 -04:00
Steven Murdoch
da34360952
Factor out and re-write code for splitting lines from a handle
...
Now handles non-printable characters and will not output a spurious
new-line if given a partial line.
2011-08-30 14:55:51 +01:00
Steven Murdoch
bc97f41080
Refactor out command line formatting
...
Now correctly handles whitespace, quotes and backslashes. Passes all unit tests.
2011-08-29 14:37:38 +01:00
Steven Murdoch
f1ff65dfad
Replace two magic tristates with #define'd names
...
- process_handle_t.status
- return value of tor_get_exit_code()
2011-08-29 00:30:18 +01:00
Steven Murdoch
3f0a197aad
Make signature of tor_spawn_background more conventional
...
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-28 23:35:02 +01:00
Steven Murdoch
1da5081ae0
Appease "make check-spaces"
2011-08-24 21:34:13 +01:00
Steven Murdoch
476807211c
We don't need to find our own path, just tell Windows to search
2011-08-24 20:50:58 +01:00
Steven Murdoch
6304e088d0
Find test-child.exe by looking in same directory as test.exe
2011-08-24 19:56:38 +01:00
Steven Murdoch
50504fc4cb
Fix test cases to handle MSYS style paths (/c/foo rather than c:/foo)
...
Also fix test case to expect 1 on successfully spawning a subprocess
2011-08-22 20:05:11 +01:00
Steven Murdoch
1ad986335a
Tidy up subprocess code
...
- Better error handling
- Write description of functions
- Don't assume non-negative process return values
2011-08-22 19:43:38 +01:00
Steven Murdoch
f46f6aabb4
Fix some compiler warnings
2011-08-22 18:13:58 +01:00
Steven Murdoch
7d015c886a
Complete logging of output from port forwarding helper
2011-08-18 18:41:23 +01:00
Steven Murdoch
5bf9890b3b
Test case for reading the partial output of a background process
2011-07-25 04:08:08 +01:00
Steven Murdoch
2d5059e08e
Use PeekNamedPipe to avoid blocking ReadFile when there is nothing to read
2011-07-22 21:12:00 +01:00
Steven Murdoch
55a1cb53d6
Add code to read all from a handle, but this block forever
...
See http://stackoverflow.com/questions/3722409/windows-child-process-with-redirected-input-and-output
for a potential solution
2011-07-22 15:57:56 +01:00
Steven Murdoch
fec902dd60
Add Windows version of tor_spawn_background and ancillary functions
2011-07-21 19:26:19 +01:00
Steven Murdoch
35c89be02b
Generalize process spawning so its test compiles (but fails) in Windows
...
- 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-21 16:34:48 +01:00
George Kadianakis
810a7a5fa0
Make some utility functions.
...
* Create a function that will get input from a stream, so that we can
communicate with the managed proxy.
* Hackish change to tor_spawn_background() so that we can specify an
environ for our spawn.
2011-07-13 18:59:52 +02:00
Nick Mathewson
b2e7c356db
Prefer tt_assert in unit tests, not tor_assert
2011-06-08 20:33:53 -04:00
Sebastian Hahn
3bf808c341
Fix a minor coverity-found bug in tests
2011-06-08 20:00:47 +02:00
Nick Mathewson
4ac8ff9c9f
Merge remote-tracking branch 'origin/maint-0.2.2'
2011-05-15 20:22:44 -04:00
Nick Mathewson
3b6cbf2534
Add a function to pull off the final component of a path
2011-05-15 20:20:29 -04:00
Nick Mathewson
aa8db013e4
Fixup whitespace issues from 3122 commit in 0.2.3
2011-05-15 20:13:12 -04:00
Nick Mathewson
9fba014e3f
Merge remote-tracking branch 'public/bug3122_memcmp_022' into bug3122_memcmp_023
...
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-11 16:39:45 -04:00
Nick Mathewson
9964c314c6
fwd-port test_util_di_ops into tinytest format
2011-05-11 16:25:51 -04:00
Nick Mathewson
d8cb4f9f0c
Use read_all() to read messages from spawn_background
...
Using read() is an invitation to get some of the data you want, not all.
Possible fix for bug 2462
2011-05-04 23:32:18 -04:00
Nick Mathewson
394a6bf4cd
Merge remote branch 'origin/maint-0.2.2'
2011-01-03 12:47:58 -05:00
Nick Mathewson
bb5f99d4df
Merge remote branch 'sebastian/bug2314' into maint-0.2.2
2011-01-03 12:47:14 -05:00
Nick Mathewson
8730884ebe
Merge remote branch 'origin/maint-0.2.2'
2011-01-03 11:53:28 -05:00