aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util.c
AgeCommit message (Collapse)Author
2023-09-13Add diagnostic log message for compression bombs.Alexander Færøy
This patch causes `tor_compress_is_compression_bomb()` to emit a warning-level log message that lets us learn the potential ratio of the input to output buffer sizes. Hopefully, this will give us a bit of a better idea whether the compression bomb ratio needs some tuning. See: tpo/core/tor#40739.
2022-10-28thread: Bump max detectable CPU from 16 to 128David Goulet
Lets take advantage of those beefy machines ;). Closes #40703 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-08-16Merge branch 'maint-0.4.5' into maint-0.4.6Alexander Færøy
2021-08-16Always teardown capture of logs in CAPTURE().Alexander Færøy
This will hopefully solve an issue where our gmtime related tests are failing on 32-bit builds.
2021-08-16Merge branch 'maint-0.4.5' into maint-0.4.6Nick Mathewson
2021-08-16Disable message checking for some 32-bit tests about timegm failure.Nick Mathewson
Since we merged 40383, we don't expect these to give the same warning on every platform.
2021-07-06Merge branch 'maint-0.4.5' into maint-0.4.6George Kadianakis
2021-07-06Use native timegm when available.Nick Mathewson
Continue having a tor_gmtime_impl() unit test so that we can detect any problems in our replacement function; add a new test function to make sure that gmtime<->timegm are a round-trip on now-ish times. This is a fix for bug #40383, wherein we ran into trouble because tor_timegm() does not believe that time_t should include a count of leap seconds, but FreeBSD's gmtime believes that it should. This disagreement meant that for a certain amount of time each day, instead of calculating the most recent midnight, our voting-schedule functions would calculate the second-most-recent midnight, and lead to an assertion failure. I am calling this a bugfix on 0.2.0.3-alpha when we first started calculating our voting schedule in this way.
2021-04-08Merge remote-tracking branch 'tor-gitlab/mr/273'George Kadianakis
2021-03-12Run "make autostyle" in advance of new series.Nick Mathewson
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2021-02-23Merge branch 'maint-0.4.5'David Goulet
2021-02-23Merge branch 'tor-gitlab/mr/326' into maint-0.4.5David Goulet
2021-02-23Remove mallinfo() from codebaseDavid Goulet
Now deprecated in libc >= 2.33 Closes #40309 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-0840274: Add a changes file and make the same change with FD_CLOEXECNick Mathewson
2021-02-02Fix testcases regarding O_NONBLOCK on parisc/hppa architectureHelge Deller
On the parisc/hppa architecture, the O_NONBLOCK constant can be either 000200000 or 000200004, depending on the Linux kernel and glibc version on which the binary is running. Background of this can be read in this upstream Linux kernel patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75ae04206a4d0e4f541c1d692b7febd1c0fdb814 The tor testcases fail because of this, because function fd_is_nonblocking() checks hard against the O_NONBLOCK value, while it's sufficient if it would only check if one of the bits is set. Fix this trivial issue by just comparing if the returned file descriptor flag and'ed with O_NONBLOCK is non-zero. As reference, a failing build on parisc/hppa can be seen here: https://buildd.debian.org/status/fetch.php?pkg=tor&arch=hppa&ver=0.4.4.6-1%2Bb1&stamp=1612225628&raw=0
2021-01-28Merge branch 'maint-0.4.3' into maint-0.4.4David Goulet
2021-01-28Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2021-01-22path: fix directory special caseHello71
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
2020-09-17Merge branch 'tor-gitlab/mr/129'David Goulet
2020-09-17Resolve some coverity complaints in test_util_glob().Nick Mathewson
Coverity's first complaint was that we didn't check the return values from chmod. That's easily fixed. Coverity's second complaint was that there were code paths where we pass NULL to chmod. For example, if this line failed, we'd "goto done", and then pass NULL to chmod. tt_ptr_op(dirname, OP_NE, NULL); Closes #40103. Bug not in any released Tor.
2020-09-10Check if glob() is available at build-time.Alexander Færøy
This patch disables the glob() support in the path library if glob() is unavailable at build-time. This currently happens with the Android NDK used for Tor Browser. See: https://bugs.torproject.org/tpo/core/tor/40114
2020-08-12Make test_glob() pass even when run as root.Nick Mathewson
Previously the test relied on not being able to look inside 000 directories, which is a thing root _can_ do. Bug not in any released Tor version.
2020-08-12Merge remote-tracking branch 'tor-gitlab/mr/62'Nick Mathewson
2020-07-30Add a unit test for write_str_to_file_if_not_equal()Nick Mathewson
2020-07-30test_util.c: Extract utime() function.Nick Mathewson
We need this to manipulate mtimes, but only in this file.
2020-07-15Add support for patterns on %include #25140Daniel Pinto
Also adds generic tor_glob function to expand globs.
2020-07-14Merge remote-tracking branch 'tor-gitlab/mr/50'Nick Mathewson
2020-07-14Strip '\r' characters when reading text files on Unix.Alexander Færøy
This patch ensures that we strip "\r" characters on both Windows as well as Unix when we read text files. This should prevent the issue where some Tor state files have been moved from a Windows machine, and thus contains CRLF line ending, to a Unix machine where only \n is needed. We add a test-case to ensure that we handle this properly on all our platforms. See: https://bugs.torproject.org/tpo/core/tor/33781
2020-07-13Bug 31812: Change http URL's to httpsJeremyRand
2020-03-30Merge branch 'tor-github/pr/1775'David Goulet
2020-03-17Run "make autostyle"teor
2020-03-05Add a config_lines_partition() function to help with LINELIST_V.Nick Mathewson
This function works a little bit like strsep(), to get a chunk of configuration lines with a given header. We can use this to make hidden service config easier to parse.
2020-03-05Merge branch 'clang_format_prep_3'Nick Mathewson
2020-02-24Merge remote-tracking branch 'tor-github/pr/1685/head'Nick Mathewson
2020-02-12Run "make autostyle".Nick Mathewson
2020-02-06Use parentheses to avoid mis-indentations of stringified macro argsNick Mathewson
clang-format sometimes thinks that "#name" should be written as "# name" if it appears at the start of a line. Using () appears to suppress this, while confusing Coccinelle.
2020-01-21Add a function to maybe memcpy() a value, in constant time.Nick Mathewson
2020-01-14Merge branch 'ticket32825_squashed'Nick Mathewson
2020-01-14Rename UTIL_TEST_NO_WIN to reflect intentNick Mathewson
Now that these tests are skipped on windows _and_ android, we should name the macro that skips them after the functionality that the tests depend on. Closes last part of 32825.
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2020-01-07speaking of utf-8, remove strange char from commentRoger Dingledine
2020-01-07string: Add extra UTF-8 test casesteor
These test cases are validated differently by some programming languages, because those languages have incorrect UTF-8 implementations. We want to make sure that tor validates them correctly. Closes ticket 32845.
2019-12-20test_util: remove UTIL_LEGACY_NO_WIN.Nick Mathewson
It was only used in one place.
2019-12-20Android: skip tests that check UNIX user account setupHans-Christoph Steiner
* there is no ~ or HOME in Android * UIDs and GIDs in Android represent apps, not users, and Android apps cannot ever change UIDs This should be replaced by whatever @nmathewson wants to name this stuff: https://github.com/torproject/tor/pull/1436
2019-12-20Code Style: Delete PRIVATE defines that are never usedteor
Some ".c" files define *_PRIVATE macros, but those macros are not used in any header file. Delete them. These changes were created using the "make autostyle" from 32522, and then split into commits.
2019-11-11Merge remote-tracking branch 'tor-github/pr/1338'Nick Mathewson
2019-10-27Add nowrap u64 multiplication functionJosé M. Guisado
Follows #30920 Signed-off-by: José M. Guisado <guigom@riseup.net>
2019-10-22Re-run make autostyle.Nick Mathewson