aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-04-28Replace a SKIP_HOST with toyonly.Rob Landley
2020-04-27Redo toysh variable expansion plumbing to start ${} (variable expansion canRob Landley
now return error), inline utf8spnc and merge_arg(), unify "break" logic, fix "continue" and "done; done", fix cd not to expand arguments twice
2020-04-24More shell tests.Rob Landley
2020-04-16Yet more shell tests.Rob Landley
2020-04-15Echo tests for new unescape2() functionality.Rob Landley
2020-03-29file: add 7z test fileJoeky
2020-03-28sed s///: support POSIX I as synonym for iElliott Hughes
POSIX chose I rather than i as the case-insensitive flag for s///, because apparently more seds support I than i. We're allegedly alone in only supporting i. (On the Mac, sed supports neither.) Strictly this isn't *currently* in POSIX, but it's been accepted for issue 8. Bug: https://austingroupbugs.net/view.php?id=779#c2050
2020-03-23tar: implement --absolute-names.Elliott Hughes
Used by the Linux kernel build when copying kernel headers to kernel-headers.tar.gz. Bug: http://b/152244851
2020-03-13More sh tests.Rob Landley
2020-03-10modinfo: various fixes.Elliott Hughes
I came here because the new -Wno-unreachable-code-loop-increment warning didn't like the for loop on line 86. That loop is indeed not necessary. Use strend() to do a string suffix match. Use memmem() to search. It's available on macOS and Android by default, but it's behind _GNU_SOURCE for glibc, so add that to portability.h. Output the tags in the same order as the Debian modinfo. I've left "parmtype" in even though the Debian modinfo doesn't output it at all. Also fix the tests so that they work on a device that has modules for multiple kernels installed (like my laptop) --- make sure that the two modules we pick come from the same kernel.
2020-03-08cp: fix -D (--parents) (REWORK MINIMAL FIX)Jarno Mäkipää
add: test for -D fix: b/c/d/FILE not copying into a/ with -D option dirname() is not needed when handling FLAG(D) since filename under src or dest should not be changed. github.com/landley/toybox/issues/165
2020-03-06Yet more shell tests.Rob Landley
2020-03-01readelf: various fixes.Elliott Hughes
Add -e, and stop documenting no-op -W. Fix sign issues, and add a few extra sanity checks. Redo the BE/LE 16/32/64 reading. Remove the NOSPACE=1 from the -l test, and fix the -l code to match the binutils output. Most usefully, this fixes the weird way the NULL section's empty name would cause misalignment in the section to segment mapping output. Add a test for -s (symbol table).
2020-02-29Fix a couple of shell tests.Elliott Hughes
These didn't work on a system where readlink is a symlink to toybox, ironically.
2020-02-29More shell tests.Rob Landley
2020-02-26More sh tests.Rob Landley
2020-02-25Shell ! testsRob Landley
2020-02-17More sh tests.Rob Landley
2020-02-14Tests for upcoming sh plumbing.Rob Landley
2020-02-11chattr: fix exit status, redo the tests.Elliott Hughes
The e2fsprogs chattr(1) returns failure when it fails to do what was asked of it, and so should we. Fixing this then reveals a lot of issues with the tests that were being accidentally swept under the carpet. The bulk of this patch is going through all the tests, removing the duplicates and making the remaining tests more thorough. I've tested this on ext4 and f2fs on a variety of 4.x and 5.x kernel versions (but nothing older). We might need to reduce the list of attribtues we try to toggle, but the more thorough tests use well-supported attributes. I've also fixed the -R test to actually involve a directory hierarchy.
2020-02-06Basic parenthetical subshell support.Rob Landley
2020-02-04More (subshell) work (not finished), fix {block;} | pipes.Rob Landley
2020-02-02vi: fix dw_last test, add more testsJarno Mäkipää
Fixed delete last word test. (script should not have \n since it is cursor down in vim) Added tests to check inserts Added tests to check yank and push
2020-02-01Now that both sed instances are using -E, we don't need to call it twice.Rob Landley
2020-02-01chattr.test/lsattr.test: fix on more kernels/fses.Elliott Hughes
The tests now pass on all the systems available to me (cloud Android with encrypted f2fs, current AOSP with regular f2fs, and current Debian testing with ext4).
2020-02-01Collate sed calls and remove trailing spaces.Rob Landley
2020-01-31chattr.test: fix tests.Elliott Hughes
Cope with all the extra flags added recently, and ignore random stuff from the environment like extents and encryption. Tested on a cloud Android emulator with f2fs.
2020-01-31Call sed twice instead of five times.Rob Landley
2020-01-31lsattr.test: clean up and fix.Elliott Hughes
My previous attempt to fix this worked for ext-with-extents on the desktop, but not for f2fs-with-encryption on cloud Android devices. This feels quite a bit cleaner, and has the benefit of actually working everywhere I've tried it. I've also added perfunctory testing of -p too, which was missing before.
2020-01-30Couple more tests and sh comment changes. (Mostly todo list tracking.)Rob Landley
2020-01-30More sh tests.Rob Landley
2020-01-28lsattr: fix tests.Elliott Hughes
I'm trying to switch Android over to toybox chattr/lsattr from e2fsprogs. Remove those tests that relied on being able to use chattr(1), remove the duplication that tested both a bare name and a full path, take into account all the flags that lsattr can now output, and cope with the fact that the exact flags you'll see depend on your file system. (Unfortunately this means trusting lsattr in the lsattr tests, which isn't ideal, but without a known environment I don't think we can do any better.)
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.