745 Commits

Author SHA1 Message Date
Rob Landley
48aa258f23 Just comment out the new tests until toysh can runs the test suite. 2025-01-10 16:46:10 -06:00
Rob Landley
c914983e3a Workaround mksh expanding ~ even when it's not the first char in a word. 2025-01-10 11:06:25 -06:00
Rob Landley
58500b8029 Adjust various tests to pass on TEST_HOST debian bookworm. 2025-01-06 09:47:13 -06:00
Rob Landley
b099b26fbc Test -nt and -ot should only check nanoseconds when seconds match. 2025-01-05 17:47:03 -06:00
Ray Gardner
1f1641cc4f Add test for setting NF=0 2024-12-03 14:09:20 -06:00
Rob Landley
97b5ea16cf Fix backslash parsing in $'' so \' doesn't end quote context. 2024-11-23 02:53:29 -06:00
Rob Landley
2045c95214 Kana provided the file, and clarified the ==4 check excludes fat16. 2024-11-08 16:12:18 -06:00
Rob Landley
d04c449ebf Comment out test that submitter didn't include test file for,
and move *type=='v' check back under distinguishing between vfat/iso9660
instead of run for all filetypes and potentially triggering if a new
4 letter physical filesystem type starting with v shows up in future.
2024-11-08 15:36:12 -06:00
Kana Steimle
eafb0b6bb5 blkid, mount: fix blkid -L and add support for mount LABEL=...
Fixes `blkid -L`, and uses that to implement `mount LABEL=...`, the same way
`mount UUID=...` was implemented.

Previously blkid would erroneously print SEC_TYPE="msdos" for vfat filesystems
when the -L option was passed. This line is moved to only print it when neither
-U or -L are passed.

Also fixed to match util-linux's blkid behavior better: SEC_TYPE="msdos" is not
added to the list of tags when the vfat filesystem is fat32 (presumably because
fat32 is not compatible with msdos). A test is added to check this behavior.

To create the fat32.bz2 file used by the test, run the following commands:
$ fallocate -l33M fat32
$ mkfs.vfat -n myfat32 -i 0xB25B2ECB -F 32 fat32
$ bzip2 fat32

It's my first time submitting a patch to any project, so if there's anything I
should do differently in the future, please let me know.
2024-11-08 03:09:37 -06:00
Rob Landley
c47184b389 Annotate broken test_sh which bash (TEST_HOST) passes but toysh doesn't.
By default, known broken tests are skipped, use "BROKEN= make test_sh" to
run them. This yanks 65 tests, leaving 289 which currently pass.

(A lot of the toysh test suite was always aspirational, notes-to-self
to handle some corner case. Unfortunately, that made it less useful for
regression testing changes...)
2024-11-03 17:23:20 -06:00
Rob Landley
fa34b1250f TEST_HOST behavior changed between bash 5.0 and 5.2 2024-11-03 16:58:08 -06:00
Karthikeyan Ramasubramanian
b98e7eba91 Support non memory mapped access
Add --no-mmap flag to indicate seek and read/write access. This allows
accessing devices that do not support mapping into memory - eg.
/dev/nvram, /dev/msr0 etc.

Also currently only WIDTH bytes are mapped into memory even when more
data is accessed. Fix this by mapping WIDTH * number of data.

Test: ./post_update.sh && m toybox. Push devmem test into DUT and access
/dev/mem through memory mapped access, /dev/nvram & /dev/msr* through
non memory-mapped access. Also update the toybox test cases to include
the non memory mapped access and confirm that all the tests are passing.

PASS: devmem read --no-mmap default (4)
PASS: devmem read --no-mmap 1
PASS: devmem read --no-mmap 2
PASS: devmem read --no-mmap 4
PASS: devmem read --no-mmap 8
PASS: devmem write 1
PASS: devmem write 2
PASS: devmem write 4
PASS: devmem write 8
PASS: devmem write --no-mmap 1
PASS: devmem write --no-mmap 2
PASS: devmem write --no-mmap 4
PASS: devmem write --no-mmap 8
PASS: devmem write 1 multiple
PASS: devmem write 2 multiple
PASS: devmem write 4 multiple
PASS: devmem write 8 multiple
PASS: devmem write --no-mmap 1 multiple
PASS: devmem write --no-mmap 2 multiple
PASS: devmem write --no-mmap 4 multiple
PASS: devmem write --no-mmap 8 multiple

Changelog since v1:
- Removed android specific files
- Removed xlseek after xwrite since xwrite advances the position
- Added test cases for --no-mmap access
2024-10-25 23:40:19 -05:00
Ray Gardner
4a31815805 Update awk.test
Add tests for split() via an empty regex string and empty regex literal..
2024-10-23 12:00:12 -05:00
Ray Gardner
0631575ba0 Update awk.test
Add tests for last several commits
2024-10-23 11:54:53 -05:00
Rob Landley
4073e77933 Add O_NONBLOCK and O_NOCTTY to grep's open flags, so grep -r doesn't
catch on FIFO and tty dev nodes quite so easily. Add FIFO test.
2024-10-19 18:06:41 -05:00
Daniel Rosenberg
aea95681c2 Fix diff between symlinks and fifos
diff should allow comparison between regular files and fifos
Added a few tests to help catch regressions here, and added
some cleanup for files the test creates.
2024-09-05 10:30:35 -05:00
Ray Gardner
27d18f0068 Fix nextfile; add tests
The nextfile statement was failing because it left unprocessed input in the
record buffer from the current file. Mod to reset the buffer so it will get
data from the next file immediately. Add a test for the nextfile fix and also
for the preceding commit that fixed the 'getline var' bug (not setting it as a
numeric string if needed).
2024-09-04 00:15:53 -05:00
Daniel Rosenberg
8bed55bb67 Support diff --no-dereference 2024-09-03 23:23:14 -05:00
Rob Landley
d50372cad3 Add obsolete sparse format test file, with test.
The trick is legacy tar ignores --sparse-format unless you also say --posix.
2024-08-16 23:51:51 -05:00
Elliott Hughes
d9d0a1c6e6 file: don't print ELF flags unless we've verified the bitness.
This was the file(1) crash mentioned in #503.
2024-08-10 15:31:32 -05:00
Elliott Hughes
f4ab441ca3 devmem.test: ignore whitespace.
Yet again, I am victim of my own bad habit of only testing on my Debian
desktop... It turns out that [current] Debian od uses a single space
between fields, macOS od uses a tab between fields, and toybox od uses 4
spaces between fields. (Given that POSIX just says "one or more <blank>
characters", I assume this isn't a new problem.)

Sidestep this with NOSPACE=1 for all the od-using tests.
2024-08-01 14:06:29 -05:00
Elliott Hughes
686ca43323 devmem: add -f FILE, arbitrary amounts of data.
-f lets people use /dev/port for x86 i/o ports (rather than needing a
separate x86-only command), or /dev/nvram, or /dev/cpu/*/msr, or
/sys/bus/pci/devices/*:*:*.* ... you get the idea.

It also means we can write some tests. (Though of course, the tests
don't tell us whether this actually works with, /dev/foo, or whether
you actually need to lseek()+write() rather than mmap().)

Also support arbitrary numbers of writes (with address auto-increment).
2024-08-01 01:16:30 -05:00
Elliott Hughes
9b28d1ba0b tar.test: don't test non--p behavior as root.
Fixes https://github.com/landley/toybox/issues/512.
2024-07-25 03:01:14 -05:00
Rob Landley
efb0b3921f Check in the file the new tar test needs. 2024-07-12 00:18:41 -05:00
Rob Landley
e4a106afa0 Add tar umask tests. 2024-07-11 13:08:16 -05:00
Rob Landley
afc993e265 Test failure as well as success, and can't use toyonly with NOHELP. 2024-07-04 14:51:38 -05:00
Oliver Webb
a8ead345f8 test -ef -ot -nt (POSIX 2024) 2024-07-03 12:34:06 -05:00
Ray Gardner
a5051b9647 Update awk.test
Fix 64 bit rshift test; remove trailing spaces; a few other tweaks
2024-06-28 00:44:09 -05:00
Ray Gardner
c4b59be67f Fix printf "%c" bug; fsprintf() cleanup; add tests
printf "%c", "ú" printed wrong UTF-8; fixed. Still have printf/sprintf() bugs.
Added toybox awk tests.
2024-06-28 00:44:01 -05:00
Ray Gardner
250bcf70fa Move math builtin code into main interp loop
Inlined the math builtins into the main interpreter loop (thanks Oliver Webb), updated toybox test file with bitwise ops tests
2024-06-28 00:43:24 -05:00
Rob Landley
4cba51ad5f Move test file to the right place. 2024-06-28 00:35:42 -05:00
Eric Roshan-Eisner
18595cad2e vi: simplify tests
I wrapped the repeated test infrastructure in a `vitest` function and inlined the dozens of tiny input files.

I shortened some of the test inputs to be clearer and discovered a couple bugs, left for now as commented out tests:
* `b` movement is off by one.
* Deleting/moving the last part of the last line of the file is off by one, usually leaving the final character in place.
2024-06-02 04:30:27 -05:00
Rob Landley
a2c4a53e15 Fix chmod g+rX-ws and similar, plus in-passing cleanups. 2024-05-29 11:22:08 -05:00
Rob Landley
ad84f82acd toysh: implement return. 2024-05-20 23:34:07 -05:00
Rob Landley
6840392df1 Stack longjmp return vectors so builtins calling builtins can xexit()
back to the shell.
2024-05-20 22:48:26 -05:00
Rob Landley
dbe06f2ff3 Skip test that triggers a macos bug. 2024-05-15 13:29:06 -05:00
Rob Landley
6800a95ef3 Ray Gardner pointed out we were adding the +4 to the wrong side of
the strlower() check for unicode facepalm. With test.
2024-05-08 01:43:44 -05:00
Rob Landley
ddd83be0a4 find -size implies -type f. 2024-04-26 10:52:02 -05:00
Rob Landley
f2079e0f44 A sufficiently loaded server may not be able to fork()/exec()
in .1 seconds (Elliott saw this), so give it a full second.
2024-04-12 11:58:37 -05:00
Rob Landley
b947b52b81 Promote fold and touch tests to "make tests". 2024-04-04 22:04:41 -05:00
Elliott Hughes
f58425918a Reduce ifconfig test flake.
I have no excuse for deflaking _one_ of the MTU tests but not the
other. I have no one to blame but myself that I'm back here today...
2024-03-22 16:09:45 -05:00
Rob Landley
39dea7710f Fix "install -dm 02750 directory" and add tests. 2024-03-22 02:59:53 -05:00
Oliver Webb
5b9542cbf8 tests for sha3sum 2024-03-04 20:35:18 -06:00
Oliver Webb
481ec7b80e bc: remove a ton of auto-generated test cases that are useless 2024-03-01 18:25:14 -06:00
Oliver Webb
93cb1c299f xzcat.c: Formatting, Cleanup, Resolve ifdefs, Tests for errors, testing -> testcmd, Rearange/Rewrite large comments to be C99, reange code (main at bottom, do_command above it), Remove some function prototypes, Remove "!= 0/NULL", "x == 0" to "!x", uint32_t to unsigned, uint8_t to char, remove vli_type typedef, remove inline (useless in modern C), Hex -> Dec when under 10, 2024-02-27 19:40:51 -06:00
Rob Landley
b89c891451 When xargs child exits with 255, stop processing input. 2024-02-21 09:45:03 -06:00
Thiébaud Weksteen
f79b72761f Update getfattr/setfattr tests
In commit 2c96060, the tests for getfattr and setfattr were updated to
only query specific names and avoid any unexpected extended attributes.
Reintroduce the generic tests by filtering out any attribute in the
`security` namespace.
2024-02-21 06:44:59 -06:00
Thiébaud Weksteen
2c96060080 Fix tests for getfattr/setfattr
The test system may have extended attributes set by default (for
instance, security.selinux on Android). Use the -n option to limit the
output.
2024-02-20 12:50:47 -06:00
Rob Landley
43c9ee3321 Fix nbd-client.test to not abort "make tests".
(If we exit instead of return from scripts/test.sh the subshell doesn't
marshall $FAILCOUNT into the file "continue", which is interpreted as the
test having crashed so the plumbing exits with 1.)
2024-02-18 19:51:53 -06:00
Rob Landley
ea51fa537a Forgot to check in nbd-client.test. 2024-02-17 18:47:34 -06:00