aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-01-25vi: Add testsJarno Mäkipää
Test file integrity after load, move, delete and save+exit. Drawing of buffer is not tested yet. Added -s script option, accept file that is run as startup script of commands. File is parsed byte at time and handled as you had typed it. If EOF has been reached without editor close command, editing is continued normally using keyboard. This functionality is in vim and neovim, but not in POSIX vi standard. nvi (vi used in some macs) has -s with different meaning... Some simple tests added, dw last line test fails, so test is disabled.
2020-01-24cp/mv: add -T.Elliott Hughes
The kernel script scripts/kconfig/merge_config.sh uses cp -T. (Also sort the options into alphabetical order while adding -T, so that eyeball binary search actually works when trying to find an option! Oddly, they all show in reverse order because there's a bug in the help text generator, but that's a problem for another day...)
2020-01-22ifconfig.test: don't check for specific error message.Elliott Hughes
A 5.4 kernel returns EINVAL rather than ENOBUFS when you try to configure an IPv6 address with the MTU set too small to support IPv6. Rather than check for both errors, just check for generic failure for now.
2020-01-08Implement readelf(1).Elliott Hughes
Basic readelf(1) implementation, with output close enough to the binutils version to be usable with scripts that expect the binutils version. This started as an implementation of nm(1) until I realized that I almost always want readelf instead, and that you actually have to do much of the work needed for readelf just to implement nm. Arguably nm (being part of POSIX) belongs in toybox while readelf doesn't. An argument could also be made that neither really belongs in toybox, belonging in a separate set of development tools (such as binutils or the LLVM binutils). Doesn't support most of the architecture-specific stuff, most notably relocations, but is aware of things like ARM exidx sections and the common register state notes in core dumps for the "big four" architectures: arm, arm64, x86, and x86-64. Doesn't support symbol versions (but probably should). Doesn't support section groups or the -t "section details" (which is a long form of -S "section headers" that I've never seen used in practice and which isn't part of -a). Doesn't support dumping unwind info or the hash table bucket histograms. Reuses the table of ELF architectures from file(1). Not fuzzed, but successfully parses all the ELF files in my Ubuntu 18.04 system's lib directories. Attempts to exit with an error when presented with an invalid ELF file rather than struggle on as binutils seems to.
2020-01-08Implement quote removal and fix unterminated bracket expansion.Rob Landley
2020-01-07Bracket support in progress. Mind the dprintf()s.Rob Landley
2020-01-06date.test: defuse a time bomb.Elliott Hughes
One of these tests fails in the gap between the locale it's run in changing the year and Europe/Berlin's changeover (caught by our automated testing, which tends to celebrate every new year by finding mistakes in tests like this). Another test has been failing consistently since 2020 because the default date output format includes the day of the week. Rather than implement Zeller's Congruence in the shell, explicitly use a format that doesn't include the day of the week for that test (and reuse the now-fixed calculation of the current year used by the other year-sensitive test).
2020-01-06SebiderSushi reported that chmod g+s wasn't working.Rob Landley
2020-01-06Cleanup chmod tests.Rob Landley
2019-12-23Toysh passes two tests now! Woo! (Otherwise, does not remotely work right now.)Rob Landley
2019-12-23Add "texpect" and add a couple simple examples to sh.test.Rob Landley
2019-12-22gzip: reject non-gzip files in zlib path.Elliott Hughes
It turns out that zlib defaults to just copying data verbatim if the input isn't in gzip format, rather than rejecting it. Explicitly add a check that zlib isn't doing that. (The toybox inflation path already errors out.) Also add the missing test.
2019-12-22Bugfix: tee with no arguments was writing to stdout twice.Rob Landley
Add basic smoketest while we're at it.
2019-12-21Tighten up unquote_file()Rob Landley
2019-12-21Very basic patch smoketestRob Landley
2019-12-06du.test: skip on Mac.Elliott Hughes
None of the current tests are relevant on the Mac because small symlinks are inlined into inodes, as are empty directories, so everything's using zero blocks.
2019-12-06printf.test: work around bash 3.2 on the Mac.Elliott Hughes
2019-12-04ifconfig.test: deflake.Elliott Hughes
::2 can legitimately be part of an IPv6 address, causing the test to fail because the grep matches an unrelated part of the output. Be more explicit about what we're actually searching for (as the previous test already was) to avoid flakiness.
2019-11-23file.test: fix /dev/zero major/minor for Mac.Elliott Hughes
2019-11-23Fix iconv and tests on Mac.Elliott Hughes
The Mac iconv_open(3) doesn't follow Unicode TR#22 rules for charset alias matching that bionic and glibc do (and, strictly, POSIX doesn't say you have to even though it's obviously a good idea), so we have to say exactly "UTF-8" rather than "utf8". Additionally, the 2006-era bash 3.2 on current versions of macOS (because it was the last GPLv2 bash) seems to have bugs that cause it to mangle UTF-8 input, so we can't reliably echo a UTF-8 sequence into a file. Use \x in the tests to work around this.
2019-11-23id.test: fix tests on Mac.Elliott Hughes
BSDs call the root group "wheel" instead. Also remove the duplicated "id id" from the progress output.
2019-11-23Don't use an internal implementation detail of skipnot in a test file.Rob Landley
2019-11-23cat.test: fix tests for Mac.Elliott Hughes
/proc/self/exe doesn't exist, but $C already gives us the path to the binary. /dev/full doesn't have any equivalent afaik, so skip that test if /dev/full is missing.
2019-11-23Don't test for specific error message output, they vary by libc version.Rob Landley
Check that the filename we fed in is output to stderr.
2019-11-22Add getopt(1).Elliott Hughes
Includes new tests.
2019-11-22env.test: be sure to call toybox env.Elliott Hughes
This was failing on macOS because it was calling the system env(1).
2019-11-12Don't rm prompt for nonexistent, just warn.Denys Nykula
2019-11-05find.test: add missing tests for "accidentally" fixed bug.Elliott Hughes
Bug #69 was fixed recently by commit 0b2cfcb8fdea9673f3c2e0940f1b16d5825e16ea. Add the two tests from the bug so we can close it out. Fixes #69.
2019-11-05id: fix Android issues.Elliott Hughes
glibc doesn't set errno when getpw* fails, so the perror_exit() looked fine. bionic sets ENOENT and the trailing "No such file or directory" looks silly, so switch to error_exit(). Additionally, the default format tests fail on Android because of SELinux (but for a different reason than usual!). There's no id --no-context flag, so use sed to just throw away any SELinux context.
2019-11-05id.c: fix -nG.Elliott Hughes
The previous patch broke -nG, so move the -G code back to showone() which handles -n. Add the missing tests for the various uses of -n. Also refactor the code to avoid the need to test optflags directly.
2019-11-05Switch -w tests to check boundary conditions, fix code to pass tests,Rob Landley
variable declarations go at the start of blocks, and remove specific people's names from todo items (anybody can do any todo).
2019-11-04id: various fixes.Elliott Hughes
Handle unknown groups (fixes #117). Fix -G to show *all* groups, not just all supplementary groups. Fix -Z output to not include "context=".
2019-11-03id: support numeric lookup.Elliott Hughes
Fall back to converting the "name" to an integer and calling getpwuid(). We need to update `username` for the later call to getgrouplist(). Also fix the separator printing logic to avoid a trailing ',' on `id 0`. Switch to FLAG() and move some declarations down to where they can be initialized, both for clarity. Also add simple tests. Sadly, there's no always-present user that is in multiple groups.
2019-10-31ls: Add tests for `-C` and `-x` optionsAndrew Ilijic
These tests ensure we follow the behavior of other `ls` commands, in the basic case.
2019-10-28Some basic stat tests.Rob Landley
2019-10-28Only create test file "input" when input argument isn't empty.Rob Landley
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