aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2016-04-14Fix a buffer overflow in diff -r.Andy Chu
We were doing two 32-byte memset()s instead of two 16-byte memset()s. 'dir' referred to the instance (array of 2) and not the struct type. Add some test coverage for diff, including a case that hit this bug. The bug was found by running cp.test under AddressSanitizer, since it happens to use diff.
2016-04-11sed -f - should read from stdin.Rob Landley
2016-03-30Whitespace and comment.Rob Landley
2016-03-30Implement mv -n / cp -n (no clobber).Andy Chu
This fixes a failing test case in mv.test. Test changes: - Add coverage for -i (interactive). - Better descriptions, better formatting, and removed some redundant cases.
2016-03-25basename: fix segfault on null input; add testsSamuel Holland
When passed an empty string, glibc's basename() returns a pointer to the string "." in read-only memory. If an empty suffix is given, it fits the condition of being shorter than the path, so we try to overwrite the null byte and crash. Fix this by just ignoring empty suffixes; they don't do anything anyway.
2016-03-24Debian bug 635570 did something horribly nonstandard (depending on a sideRob Landley
effect of "sed -e 'a\'" with no trailing line). But there's an actual user, and it's not hard to implement, and it's not hard to implement, and there isn't an obvious _other_ way to do it, so add the behavior and a test for it. Fix some bad/missing comments while I was there, and add a couple TODOs.
2016-03-23Fix bzcat.test (as noted by Andy Chu), wean tests off $TOPDIR and supply $FILESRob Landley
instead, move tests/blkid into tests/files/blkid.
2016-03-23The test infrastructure prints the command name now, so file.test shouldn't.Rob Landley
2016-03-22blkid: Handle short/empty vfat labels; update testsSamuel Holland
vfat labels have a fixed space allocated for them. In the case of a shorter label, the remaining bytes are padded with spaces. A vfat filesystem with no label (i.e. that will show up in Windows as "Local Disk (X:)" or "Removable Disk (X:)") is stored as "NO NAME ". Both of these changes match behavior from util-linux.
2016-03-20Posix requires "" to be false, and 00 should be false, and -0 should be false.Rob Landley
Fix memory leaks in regex. Simplify regex check (if we matched, subexpression had to match). Don't exit() from a command, set exitval and return.
2016-03-18Fix last commit (had newline before first ==> name <==) and add -f tests.Rob Landley
2016-03-17Remove 'exit' from xargs test too.Andy Chu
2016-03-17Fix bug where all tests aren't being run with 'make test'.Andy Chu
The tests/*.test files shouldn't explicitly exit, because they are sourced in scripts/test.sh. No tests after sed were being run.
2016-03-16Move whitespace and curly brackets around, move reference URLs to top of file,Rob Landley
eliminate syntax_error() function (just call error_exit() directly), eliminate advance() wrapper, pipe expected error messages in test to /dev/null
2016-03-16Fix type coercion bugs in expr.Andy Chu
All tests pass now; this fixes the 2 remaining failures, including a segfault. The structure of the code has changed a lot -- instead of having a tiny function per operator, we have eval_op() which does common type coercion and then evaluates the operator. I tried writing it a couple different ways, and this was the cleanest. The OPS table now contains the operator string, precedence level, signature for type coercion, and operator ID.
2016-03-16Fix the operator precedence in expr.Andy Chu
expr now uses the precedence table specified by POSIX, implemented using the "precedence climbing" algorithm. See the references at the top of eval_expr(). This fixes 3 of 4 failing tests. I also added more tests for correct behavior and for syntax errors. This includes a new test exposing a segfault, related to type coercion.
2016-03-15Add base64.test, and Izabera pointed out that -w0 should disable wrapping.Rob Landley
2016-03-10Fix segfault in sed -e 'c\'.Andy Chu
Found by afl-fuzz.
2016-03-03Fix bzcat integer overflow reported by John Regehr.Rob Landley
2016-03-02Fix file for Java class files, improve script detection, and add tests.Elliott Hughes
2016-03-02Factor out command name at the start of test name, have runtest.sh print it.Rob Landley
2016-03-02Print command name at start of each test.Rob Landley
2016-03-02Split lsattr/chattr tests.Rob Landley
2016-03-02Command name at start of each test.Rob Landley
2016-03-02Add fstype test.Rob Landley
2016-03-02Try to consistently print command name at the start of each test.Rob Landley
2016-03-02split pgrep/pkill tests.Rob Landley
2016-02-19Add xxd -p and -r.Elliott Hughes
SELinux denials include hex-encoded paths in the log messages; xxd -r -p is a convenient way to decode them. The heuristics are a little weird to my mind, but match the documentation and observed behavior.
2016-02-17The perl build's attempt to escape spaces and such in LD_LIBRARY_PATH is _SAD_.Rob Landley
It uses a sed expression that assumes you can escape - to use it as a literal (you can't, it has to be first or last char of the range), and assumes you have to escape delimiters in sed [] context (you don't), and/or that non-printf escapes become the literal character (they don't, the backslash is preserved as a literal), meaning it winds up doing "s/[\-\]//" which is a length 1 range, which is officially undefined behavior according to posix, and regcomp errors out. But if we don't accept it (like other implementations do) the perl build breaks. So collapse [A-A] into just [A]. Testcae taken from perl 5.22.0 file Makefile.SH line 8. (While we're at it, remove an unused argument from a function.)
2016-02-17Testfile with the 3 different types of "not utf8 output" escaped chars in it.Rob Landley
2016-02-10toybox: tar: Fix support for long namesTom Marshall
Pathnames may be longer than the name field in the header, so use strncpy() instead of xstrncpy() to avoid bailing out. Also add unit tests to ensure proper handling of short and long pathnames. Change-Id: Id025891993746889564b479e5185cf9721b54a55
2016-02-10toybox: tar: Fix tar testsTom Marshall
Don't rely on ordering of readdir for tests. Change-Id: Ice24bb64ce453acb0006e3746677d619db933ab1
2016-02-10Add seq -w, suggested by izabera.Rob Landley
2016-02-05Fix segfault when `find -iname` gets no argument.Josh Gao
2016-02-04Fix -H and -n with -ABC, and add tests.Rob Landley
2016-01-31More testsuite tweaks.Rob Landley
2016-01-31chmod.test had umask assumptions which broke, so set explicit umask.Rob Landley
2016-01-31Fix broken test in cat.test.Rob Landley
"cat /proc/self/exe && cmp /proc/self/exe" won't see the same file if cat and cmp aren't both in a toybox multiplexer binary, so snapshot and pick one.
2016-01-31Fix blkid typo (label wasn't detected in murderfs).Rob Landley
2016-01-31Tweak to "find" tests.Rob Landley
2016-01-30Add grep -B -CRob Landley
2016-01-30Add grep -ARob Landley
2016-01-21Add a sed test from the posix mailing list.Rob Landley
2016-01-15More utf8 test files.Rob Landley
2016-01-15Fix sort -f, add tests, make TEST_HOST pass new tests.Rob Landley
2016-01-05Some utf8/unicode stress test files.Rob Landley
2015-12-06Enable matching any perm bits.Gilad Arnold
Includes tests for the new feature, and a failure case for the minimal perms test as well. Also some typo fixing / massaging the help text so it fits in 80 columns.
2015-12-04Tom Marshall reported that blkid was handling ext2 wrong.Rob Landley
Even though ext2 has a comment that it has to be at the start, I added swap to the start of the array (oops). The test suite was also wrong (it was matching the _incorrect_ output).
2015-12-04Replace duplicate sed test with case we hadn't covered yet.Rob Landley
2015-11-19Fix find -perm.Elliott Hughes
1) It read st_dev instead of st_mode. 2) It reversed the semantics of absolute vs minimal ('-' prefixed) tests. Add tests for these, and move the "unterminated -exec" test into the "Still fails" section because it's still dumping core for me.