6 Commits

Author SHA1 Message Date
Rob Landley
e794647d2a Avoid spurious test failures when fork() coincides with signal being sent,
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.
2019-09-22 09:45:30 -05:00
Elliott Hughes
903f06c778 killall: implement -w.
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.
2019-07-25 21:41:03 -05:00
Elliott Hughes
90ba72902d killall.test: fix flakiness.
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.)
2019-07-25 21:31:23 -05:00
Elliott Hughes
82a33b3f06 killall: better handling of long names.
Change names_to_pid() so that we can actually match shell scripts with
long names (the code to get the shell script's name was correct, but
there was an extra test preventing us from actually comparing it to the
sought name).

In kill.c itself, remove a dead test for -l and switch to the FLAG()
macro.

Also extend the tests to explicitly cover long and short names.
2019-07-06 16:15:35 -05:00
Elliott Hughes
38e239f7c1 killall.test: don't assume the shell is /bin/sh.
The killall test still fails with toybox. Seems like right now killall
and pidof share name to pid logic, but playing about with the desktop
killall (which does pass this test), it seems like killall actually
behaves more like pgrep than pidof (which does seem to be this limited
on the desktop too)...
2019-06-25 18:45:53 -05:00
Elliott Hughes
9356adb28d killall should kill scripts too.
Found running LTP file system tests on Android.

Bug: http://b/70627145
2017-12-19 14:49:25 -06:00