[Toybox] I aten't dead.

Joe Nosay superbisquit at gmail.com
Fri Nov 27 12:28:00 PST 2015


Quothe the Raven, "Nevermore."

On Thu, Nov 26, 2015 at 1:29 PM, Rob Landley <rob at landley.net> wrote:

> Sorry for the radio silence, I've been working on stuff.
>
> So there's a pile of ps and top patches awaiting me on the list, and I
> want to fold top _into_ patch because in theory they're 90% the same
> infrastructure. So I started by adding --sort to ps, which involved
> splitting the "fetch data from /proc" and "display data" parts into
> two separate passes. (In the common case the first function calls the
> second, and I managed to slice and dice toybuf so it all still fits in
> there in that case.)
>
> However, breaking stuff up and shuffling it around broke things, to
> the point where the TTY field is showing "-1:-1" for some processes,
> and I need to retest everything in ps to make sure I fix it all.
> (That's why I haven't checked it in yet, right now it's a regression.)
>
> As LONG as I need to retest everything, I decided to sit down and fix
> up the aboriginal linux infrastructure to let me run a testsuite in a
> controlled (and run as root) environment under there.
>
> So I did the aboriginal upgrades (including more granular dependencies
> that make rebuilding minor userspace tweaks over and over go faster),
> and started a ps test suite and...
>
> It's still pretty darn hard. Here's what I have so far
>
> ---
> #!/bin/sh
>
> [ -f testing.sh ] && . testing.sh
>
> notroot && continue
>
> #testing "name" "command" "result" "infile" "stdin"
>
> # This is necessarily somewhat brittle, because the PID numbers change
> # all over the place (how many kernel threads did this kernel version
> launch?)
> # the time field can change, tty varies by target (serial device name)...
>
> # We test matching expected PIDs under aboriginal linux running under qemu
> for
> # the first few, then mask them out or don't request them for the rest.
>
> TTY="$(tty | sed 's@^/dev/@@')"
>
> # The $() around printf strips trailing newline, so we have to add it back
> DEFPAT="%5s %-8s 00:00:00 %s\n"
>
> # calculat/match an actual PID
> BASEPID="$(awk '{print $1}' /proc/self/stat)"
> testing "ps" "ps | tail -n 2" "$(printf $DEFPAT\n" $(($BASEPID+5))
> $TTY ps $(($BASEPID+6)) $TTY "tail -n 2")\n" "" ""
> # init can use a single digit number of seconds of cpu time before this
> breaks
> testing "ps -A" "ps -A | head -n 2 | sed 's/00:00:0[0-9]/00:00:00/'" \
>   "$(printf $DEFPAT\n" 1 ? BLAH" "" ""
>
> -----
>
> And the "BLAH" part at the end is where I hit "of course the name of
> init isn't init here, in this test environment it's "/sbin/oneit -c
> /dev/ttySO /mnt/init" which is TOTALLY generic isn't it? I'm already
> hitting the time with sed to regularize it and have a HEURISTIC to
> skip 5 process IDs because that's what the "testing" script eats
> before running the actual test, but _that_ level of regularizing means
> what am I actually _testing_ here...
>
> Grrr. When I say many tests are easy to do by hand and a serious pain
> to automate, that is exactly what I mean...
>
> Rob
>
> P.S. The kernel moved the jiffy start time to something like ten
> minutes before it wraps to force that to get testing, it hasn't done
> that to the PIDs but it COULD. Probably won't because PID 1 is special
> and it already wraps in regular use anyway, but still...
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20151127/2079df87/attachment-0004.htm>


More information about the Toybox mailing list