aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2021-02-08Yi-Yo Chiang pointed out install -D was broken when the target file exists.Rob Landley
Add a test, with comment that "make install_test" doesn't currently exist...
2021-02-06netcat.test: reduce flake.Elliott Hughes
Starting two netcats at the same time and expecting them to be able to talk to each is a little optimistic. I don't know whether `sleep .1` will be sufficient, but wanted to try that before going to `sleep 1` since neither the toybox nor the github nor the Android infrastructure is running these tests in parallel, those seconds add up. Right now this has a ~20% flake rate on the Android infrastructure. I was able to reproduce the flake locally with `while true ; do make test_netcat ; done` on my desktop before this patch, but not after. (Though my desktop is way overpowered for just running that, whereas the build servers tend to be pretty busy, which is why I reserve the right to return later with a longer delay.)
2021-02-01rm: Add testcase for "rm -f <readonly_filesystem>/missing_file"Yi-Yo Chiang
2021-01-26Fix bug pointed out by asm89 and add test.Rob Landley
2021-01-23Fix grep bug where -f /dev/null added "" regex matching everything,Rob Landley
and address TODO where -z was still splitting patterns on \n
2021-01-14A few more shell tests.Rob Landley
2021-01-08chmod.test: fix the tests to work on mksh as well as bash.Elliott Hughes
mksh doesn't support the {a..b} bashism or the ${!name} bashism, causing the tests to fail on Android. This works for me on both mksh and bash (both tested on Debian).
2021-01-07new toy: base32Moritz Röhrich
Add new toy `base32`. Add tests for `base32`. base32 is added by adapting the base64 encode/decode function to also do base32 encoding/decoding. Then their respective main functions set up the global parameter `n` to be the number of bits used in the encoding (5 for base32 and 6 for base64) and `align` to align the result to a certain length via padding. These are deliberately kept as parameters to enable future expansion for other bases easily.
2021-01-01Fix comma regression reported by Denys Nykula.Rob Landley
2020-12-25toysh fixes and testsRob Landley
2020-12-18Add seq INT_MIN test.Rob Landley
2020-12-18Elliott said that chmod 000 debris was confusing host rm -rf, and macosRob Landley
couldn't handle chmod +s in /tmp. Try to make test_chmod clear out debris and teach make clean to chmod -R generated before deleting it.
2020-12-14Add test for FEXTRA flag on gunzipPuck Meerburg
2020-12-12Speed up seq: use toybuf for block writes and add an integer fast path.Rob Landley
2020-12-07sed: add 'x' flag to the 's' command.Elliott Hughes
The GNU tar manual, when talking about the `tar --transform` option that I need to implement, describes the 'x' flag by saying "regexp is an extended regular expression (see section 'Extended regular expressions' in GNU sed)". Only it turns out that even the latest GNU sed doesn't actually have that flag. It's unique to `tar --transform`. That link is just telling you that the sed manual will explain extended regular expressions, not that GNU sed also supports the 'x' flag. So I don't know whether we want this in toybox sed after all. (It made sense that sed would have such a flag, but no sed that I know of actually does.)
2020-12-06unicode: new toy.Elliott Hughes
Based loosely on the Plan9/Inferno utility, and a convenient way to go back and forth between code points and utf8 sequences. This patch also fixes a couple of bugs in wctoutf8 (and the tests for this toy effectively serve as unit tests for wctoutf8/utf8towc).
2020-12-06id.test: hacks to pass on Raspberry Pi OS.Elliott Hughes
The rest of `make tests` all pass on a Raspberry Pi 400.
2020-12-05Fix find empty argument handling and add test.Rob Landley
2020-12-05tr: fix pathological flushing.Elliott Hughes
The AOSP build doesn't use tr (or anything that's still in pending), but the kernel folks have been more aggressive. They found that tr's pathological flushing was adding minutes to their build times. Just removing the fflush() made tr significantly faster for my trivial test, but still slow, with all the time going into stdio. Rewriting the loop to modify toybuf in place and then do one write per read made most of the difference, but special-casing the "neither -d nor -s" case made a measurable difference too on a Xeon. Bug: http://b/174773617
2020-12-04chmod: support complex modes.Elliott Hughes
Change 5109da9b3e6a898c8e0ad647303a1b375e3d97d3 caused test.test to call chmod with mode `u+s+s` which passes on the host (where you have a toybox test but a GNU chmod) but fails on Android where chmod is toybox too. Add the missing loop to string_to_mode(), which means this will also affect other toys, but that seems like a feature (and, for example, GNU mkdir also accepts a mode like `a=r+w+x`).
2020-11-25Luke Frankart pointed out a typo (0x111 should be 0111). Fix and updateRob Landley
tests to catch this. While there add -k to test sticky bit.
2020-11-25Fix help text to explain why o+s isn't +t, add test +s not setting +t.Rob Landley
2020-11-15date: add --iso and the %:z output format.Elliott Hughes
I didn't know until implementing this that --iso is actually called --iso-8601 and that GNU date will actually accept any prefix. --iso-8 works fine too. I've assumed that --iso (that I always used) and --iso-8601 (as given in the documentation) are the only two that matter.
2020-10-19More tests, and a workaround to pass one of them.Rob Landley
(The bug is that "echo hello \" followed by just enter should end the $PS2 state but it persists when the line is empty because resulting collated line still ends with \ so it wants another line.)
2020-10-15chattr.test: don't fail on f2fs with compression enabled.Elliott Hughes
f2fs with compression enabled only lets you `chattr +c` on an empty file.
2020-10-13Fix up ${x%y} ${x^y} ${x,y} and add tests.Rob Landley
2020-10-11toysh: more variable/wildcard plumbing and tests.Rob Landley
2020-10-06The non-recursive dirtree_path wasn't stripping a trailing / from initial path.Rob Landley
2020-10-04Implement ${x#y} and ${x##y}Rob Landley
Debug wildcard * match, teach skipslash() to fill out a wildcard deck, make collect_wildcards() flush remove the parsing-only 0th entry.
2020-09-23TEST_HOST with util-linux 2.29.2 was... unhappy.Rob Landley
2020-09-23Fix more TEST_HOST version skew.Rob Landley
2020-09-14Fix multiline case/esac parsing, make syntax_err() exit non-interactveRob Landley
contexts like scripts, and tweak debug scaffolding.
2020-08-31Implement case/esac, add more wildcard tests.Rob Landley
2020-08-27xparsedate: support default date(1) output format.Elliott Hughes
This round trip occurs in practice with $KBUILD_BUILD_TIMESTAMP in kernel builds.
2020-08-25simplifyRob Landley
2020-08-25tar.test: fix the -Igzip test to work with toybox file.Elliott Hughes
GNU says "/dev/stdin" for the filename, but we say "-".
2020-08-24tar: add -I (--use-compress-program) support.Elliott Hughes
This also changes the other compression options (such as -j) so that we pass no arguments for compression and just -d for decompression, which is what -I does to its filter and which appears sufficient. (I think I used -dc before just out of habit, since that's what I've been typing on the command line for decades.)
2020-08-23Peter McConalogue pointed out that cp/mv -i prompt should default N.Rob Landley
Also, the failing mv test was because posix says to prompt when mv-ing over an unwriteable file only when stdin is a tty (but -i prompts either way)
2020-08-21Fix cp -P to not follow symlinks.Martin Stjernholm
Also fix help text to say that it is not the default.
2020-08-21cpio: fixes for Android kernel build.Elliott Hughes
Allow -pd to work by changing -p from an option that takes an argument to an option that implies there will be an argument (that is, `-pd x` is `-p -d x` with x being the directory for -p, rather than `-p d x` with d being the directory, as we previously interpreted it). Fix -d (aka --make-directories) to not be a no-op. Previously we acted as if this was always on. Accept --quiet and effectively just ignore it, since toybox cpio doesn't seem to produce any output that --quiet would suppress.
2020-08-04date.test: add more UTC offset tests.Elliott Hughes
Rob's code supports more formats than mine did, so add the extra tests.
2020-08-04xparsedate: support UTC offsets.Elliott Hughes
Requested in https://github.com/landley/toybox/issues/130, quoting an old version of the toybox help. This is also supported by coreutils. Set $LANG to C in the date tests so that they pass with TEST_HOST=1 (they were already failing for me, presumably related to a newer glibc).
2020-08-04echo: fix trailing \0.Elliott Hughes
This is a follow-on from 310eefe, addressing the case where sscanf fails and returns -1.
2020-08-03Mark Salyzyn implemented support for xargs -P (run parallel jobs) because heRob Landley
has a build script that goes much faster with it, and added tests for it. I reimplemented it a different way, and did SIGUSR1 and SIGUSR2 support.
2020-07-30find: support -type a,b,c.Elliott Hughes
Fixes #227.
2020-07-20patch fuzz: Always output original file's ' ' context lines, not from hunk.Rob Landley
2020-06-27The bionic/clang asan plumbing slows the test down >10x, so expand timeout.Rob Landley
2020-06-23William Djupström reported tar --exclude wasn't working. Fix and add test.Rob Landley
(Also fix -v output going to stderr when it shouldn't.)
2020-06-23More sh tests.Rob Landley
2020-06-19More sh testsRob Landley