aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2019-10-28ls: Add `-w` which sets the column widthAndrew Ilijic
2019-10-26cut: re-enable crunch_str on cut -CJarno Mäkipää
Reason: unicolumns() does not print combining characters correctly Combining characters follow the character which they modify. https://www.cl.cam.ac.uk/~mgk25/unicode.html#comb xterm renders cut test1.txt -C -1 now correctly
2019-10-26Add ln -r and relative_path() to lib, plus test.Rob Landley
And a few small cleanups while I was there.
2019-10-24Fix the xargs argument too long problem by putting the proper accountingRob Landley
back when they haven't specified -s, add tests.
2019-10-21xargs: add test for -E being a full match.Elliott Hughes
89a8d00e470f1999a62ceea81269af2f39c655ba broke -E by switching to a prefix match. 4e0d246ec98f2576d52eb5fd70cd6e86d542e2e4 fixed it again. Add the missing regression test.
2019-10-16Simple ps smoketest.Rob Landley
2019-10-12Make cmp.test pass with TEST_HOST on systems that gratuitously violate posix.Rob Landley
2019-10-12Fix argless find segfault.Denys Nykula
Inline array becomes garbage outside the if.
2019-10-11Fix same spurious test failures that were affecting killall,Rob Landley
and silence "killed" messages from the shell by forking in a subshell.
2019-10-09xargs: various fixes.Elliott Hughes
Don't run the command with no arguments if we run out of input but have already run the command at least once. The implementation of "run the command at least once (unless -r was supplied)" wasn't taking into account whether or not this was our first time round the loop. Fix the exit value, and the -- already documented but not implemented -- behavior if a child exits with status 255. Also extend the tests to cover these cases, plus cases I broke while coming up with the fix. Add more tests to convince myself that we've correctly interpreted how -s is supposed to behave, and fix the corner cases at the bottom end of the range. This fixes some issues we were seeing trying to build the Android SDK for (and more importantly, on) macOS.
2019-10-04readlink: add missing line, plus a test.Elliott Hughes
I must have lost this line somehow when I moved the patch from my AOSP tree to a toybox tree. (But the ln tests passed on the host because I was using coreutils ln there :-( )
2019-10-02tar.test: work around SELinux messing with st_blocks.Elliott Hughes
Just re-tar the extracted file and check we get the expected result.
2019-09-30Test ln -tRob Landley
2019-09-25Add ln -TRob Landley
2019-09-22Avoid spurious test failures when fork() coincides with signal being sent,Rob Landley
then pgrep finds child that hasn't exec("sleep") yet. So add 1/10 sec sleep to let exec() happen before pgrep. While we're there fix spurious "terminated" messages and reorder test file creation so it fits in 80 columns.
2019-09-17Allow --tmpdir's argument to be optional.Rob Landley
2019-09-17tar.test: add a test for a sparse file with a hole at the end.Elliott Hughes
2019-09-15Move mktemp.test comments into test descriptions.Rob Landley
2019-09-15Elliott's test for sparse file size display.Rob Landley
2019-09-13timeout: fix exit status for sneaky subprocesses.Elliott Hughes
There's nothing to stop a subprocess from catching our SIGTERM on timeout and exiting, causing us to incorrectly report that it didn't time out. Android's ART has a utility that does exactly this. Explicitly catch this case, and add corresponding tests. Bug: http://b/141007616
2019-09-09ls: fix spacing of -lZ and --full-time.Elliott Hughes
Two more spacing bugs here, one before the security context for -Z, and one after the size with --full-time. Before: $ ./toybox ls -lZ --full-time Config. -rw-r----- 1 enh primarygroup? 56162019-09-07 21:09:32.892215100 -0700 Config.in After: $ ./toybox ls -lZ --full-time Config. -rw-r----- 1 enh primarygroup ? 5616 2019-09-07 21:09:32.892215100 -0700 Config.in
2019-09-04find: support -printf \0 octal escapes and \c.Elliott Hughes
I think when I wrote this I tested the named escapes like \n and hex escapes, and when I found \x wasn't supported I didn't even think of octal. And I only learned about \c when I was looking at echo and printf to compare their escape implementations a few weeks back. Add the missing escapes and corresponding tests. Fixes #139.
2019-09-04ls: fix -Z, add a test.Elliott Hughes
This broke a netd test (but sadly in postsubmit rather than presubmit). Also add a trivial test that would at least have caught this bug. Bug: http://b/140453237
2019-08-30blkid.test: allow e2fsprogs' blkid too.Elliott Hughes
This lets me see the _meaningful_ differences between toybox and e2fsprogs, which is probably good for the health of both. I've tried to get the whitespace fixed upstream a few times since 2017, but... (The current differences are that e2fsprogs doesn't support f2fs labels, and outputs reiserfs labels after the uuid rather than before.) On the util-linux front, although my patch earlier this month fixed the tests against util-linux 2.32, I now have 2.33 on my laptop, and that's added a new LABEL_FATBOOT field :-/
2019-08-30ls: fix recent regression.Elliott Hughes
Commit c26870dab3462c6176936384b090df6b9ba46dee broke ls' error reporting for files that don't exist. `ls $F` is used by some as an equivalent of `test -e $F`. This patch also adds a regression test.
2019-08-30find: fix -name corner case.Elliott Hughes
This fixes the case where someone's done something (weird) like: find src/*.c -name foo.c Previously the match would fail because one side of the comparison was already a path.
2019-08-28Fix find(1) after c26870dab346.Elliott Hughes
Unlike ls, find does treat ENOENT specially. Add an extra test (and fix the behavior) for the case of ENOENT for a path provided on the command line --- unlike other ENOENT cases (typically dangling symlinks), ENOENT for a command line argument should report an error. Also remove obsolete `|sed` from the symlink loop test.
2019-08-21Add some 2>/dev/null to tests that produce gratuitous stderr output.Rob Landley
2019-08-19Fix bad test.Rob Landley
2019-08-19echo/printf: expand test cases, fix \x corner cases.Elliott Hughes
The behavior with "\xAV" (where the second hex digit is invalid) is different from the behavior with "\xVA", and echo and printf differ from each other.
2019-08-15find.test: allow any error message about symlink loops.Elliott Hughes
glibc says "Too many levels of symbolic links", but BSD says "Too many symbolic links encountered". Until it becomes a problem, allow any error message.
2019-08-12find.test: fix flakiness.Elliott Hughes
Don't depend on directory iteration order in a test.
2019-08-12blkid: add -s, SEC_TYPE, f2fs LABEL, and fix vfat/ntfs UUID.Elliott Hughes
This gets the tests passing with both toybox and util-linux 2.32.1 blkid. We use -s to get around the fact that we still don't support ntfs' $VOLUME_NAME attribute.
2019-08-09blkid.test: match TEST_HOST expectations.Elliott Hughes
Missing SEC_TYPE for ext3, msdos, and vfat. Missing LABEL for f2fs and ntfs. Wrong endian of UUID for msdos, ntfs, and vfat.
2019-08-09find: fix dangling symlink behavior.Elliott Hughes
ENOENT is ignored, but other errors are reported.
2019-08-05du: disable the tests if we have SELinux.Elliott Hughes
ext stores extended attributes in a way that makes all the numbers in the test incorrect. For now, just disable the test in that case.
2019-07-27losetup.test: bail out if loopback devices are already in use.Elliott Hughes
There's probably a way to filter out the existing ones, but it's likely to be pretty painful and isn't immediately necessary. (I hit this case on Android cloud x86 devices.)
2019-07-27modinfo.test: bail out early if there are no modules.Elliott Hughes
We need /proc/modules *and* a directory of modules.
2019-07-27ifconfig.test: actually skip tests if dummy0 up fails.Elliott Hughes
Rather than just claim we're doing so. Android cloud emulators don't have dummy0 like regular devices do.
2019-07-26truncate.test: work around ext extended attributes space usage.Elliott Hughes
Weaken the test slightly so that the extra 4KiB used for SELinux is ignored. Unfortunately all the du tests suffer the same problem, and I'm less sure what to do there. Mounting a read-only file system without the extended attributes might be the best idea? But since this test modifies the file system...
2019-07-26hostname: fix tests for non-root on Android.Elliott Hughes
On Android you can't even get the hostname unless you're root, to avoid device fingerprinting/tracking. Also modernize by using skipnot, which fixes the incorrect test name in the SKIP: output.
2019-07-25killall: implement -w.Elliott Hughes
This isn't currently used in AOSP, but it is used in some of the other codebases I can easily search, and it's a better fix for test flakiness than inserting a sleep.
2019-07-25killall.test: fix flakiness.Elliott Hughes
And when I say "fix", I mean "hack around in the worst possible way". Android+mksh is often slow enough that we can do the pgrep before the killed process has actually exited. (I'm seeing roughly 100% failure rate on cloud x86 emulators, and about 75% on a real Pixel 2.)
2019-07-24tests: fix for empty /etc/passwd or /etc/group.Elliott Hughes
It turns out some Android devices have an empty /etc/passwd and/or /etc/group, which was defeating the previous workaround. Switch to testing the intention more directly: we'll try the file in /etc, and if that didn't work, we'll assume we need a workaround.
2019-07-22test.tar: fix tar tests on Android.Elliott Hughes
There's no /etc/group on Android. Loop devices are in different places, but that test doesn't seem to offer anything beyond the block/char special device tests later, so remove that rather than fix it. Fix the block/char special tests (the expectations were missing, but they're never normally run on the host because the mknod fails). Likewise add the missing expectation to the "ownership" test, which isn't normally run on the host because the chown fails. The "sparse without overflow" test was broken because of the mksh/bash disagreement about whether in `VAR=val shell_function` that's a temporary assignment to VAR or one that outlives the command. Switch SUM to being a function like LST before it. Also rewrite the TARHD stuff because Android (a) doesn't have hd and (b) doesn't have process substitution in its shell. (I wish I'd noticed TARHD earlier --- I'd been manually sending the tar files to xxd for debugging instead!) With this patch, all the tar tests now pass for me on both the device and host.
2019-07-16Fix unaligned access, tweak test suite.Rob Landley
2019-07-16grep: fix two bugs found by hwasan.Elliott Hughes
The first bug appeared as a memory overwrite, but was actually visible without hwasan: basically any `grep -F` that let to multiple matches on the same line was broken. The second bug was another memory overwrite, visible when I ran the existing grep tests. Bug: http://b/137573082
2019-07-12diff: implement --strip-trailing-cr.Elliott Hughes
Used by some ART tests and also some LLVM tests. (The motivating example is the latter, but I noticed the former when looking for other users.) Bug: http://b/137298656
2019-07-12pidof: fix default behavior, add -x.Elliott Hughes
Before this patch, we're effectively doing `pidof -x` all the time. This patch changes names_to_pid() to allow us to say whether or not we want to include scripts, and adjusts the callers appropriately. Also add tests for `pidof` versus `pidof -x` which pass after this patch, without regressing the existing killall tests.
2019-07-12grep: add -R as well as -r.Elliott Hughes
On BSD these are actually the same, and there's a -S that you need in addition. So strictly this is a behavior change for Android (which is going from BSD grep to toybox grep), but it's a behavior preserving change for the AOSP build (which is going from GNU grep to toybox grep), and the latter actually has a checked-in use of -R where the former doesn't.