Age | Commit message (Collapse) | Author |
|
back when they haven't specified -s, add tests.
|
|
89a8d00e470f1999a62ceea81269af2f39c655ba broke -E by switching to a prefix
match. 4e0d246ec98f2576d52eb5fd70cd6e86d542e2e4 fixed it again. Add the
missing regression test.
|
|
|
|
|
|
Inline array becomes garbage outside the if.
|
|
and silence "killed" messages from the shell by forking in a subshell.
|
|
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.
|
|
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 :-( )
|
|
Just re-tar the extracted file and check we get the expected result.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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 :-/
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
|
|
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.
|
|
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.
|
|
Don't depend on directory iteration order in a test.
|
|
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.
|
|
Missing SEC_TYPE for ext3, msdos, and vfat.
Missing LABEL for f2fs and ntfs.
Wrong endian of UUID for msdos, ntfs, and vfat.
|
|
ENOENT is ignored, but other errors are reported.
|
|
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.
|
|
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.)
|
|
We need /proc/modules *and* a directory of modules.
|
|
Rather than just claim we're doing so.
Android cloud emulators don't have dummy0 like regular devices do.
|
|
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...
|
|
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.
|
|
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.
|
|
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.)
|
|
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.
|
|
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.
|
|
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
The test relied on the non-builtins not being toybox (or another
multicall binary). A multicall binary will actually look at the
symlinked name (in this case "true") and do what it says on the tin.
Use a tiny shell script instead.
|
|
Investigating why the toybox tar tests fail on Android with toybox dd, I
realized I was rewriting a part of dd I'd rewritten before!
This is a re-send of my 2019-02-22 patch, rebased against the current
ToT...
This patch was originally motivated because after suggesting to the author of
https://stackoverflow.com/questions/17157820/access-vdsolinux/54797221#54797221
that he could tell dd to work in bytes rather than blocks, I realized
that our dd doesn't actually support that. But the rewrite of the main
loop is necessary to fix the incorrect output from the dd calls in the
tar test.
Without this patch, `yes | dd bs=65536 count=1 > fweep` basically gives
random output, based on how many bytes the pipe feels like giving you in
your first read. (As far as I know, dd *without* bs= was fine, but I
can't guarantee that that's true, just that I haven't seen it fail.)
Also switch to TAGGED_ARRAY and comma_* for conv rather than add two more
copies of an undesired idiom. It turned out -- contrary to the belief of
cp(1) -- that comma_scan isn't suitable for this because of its magic
handling of "no" prefixes. (It's actually harmless in cp because none
of the --preserve options begin with "no", but some dd options do.) To
this end, comma_remove is a less-magic comma_scan.
I've also changed an `if` to a `while` because other implementations
allow things like `--preserve=mode,mode` or `conv=sync,sync`. (If we
decide this is a bug rather than a feature, we should at least fix the
error message to be clear that we're rejecting the *duplication*, not
the option itself.)
I've also fixed the ^C behavior by simply adding a direct SIGINT handler
rather than trying to be clever inside the read loop (which is why we
weren't handling the SIGINT until the read returned).
I've also removed `strstarteq` and just added the '=' to each literal
when calling regular `strstart`.
Plus basic tests.
|
|
|