Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On 02/20/2015 11:46 AM, enh wrote: On Wed, Feb 18, 2015 at 11:10 AM, Rob Landley r...@landley.net wrote: You could also add a hook to scripts/runtest.sh replacing the eval on line 86 with a function similar to the do_loudly function starting on scripts/make.sh line 19. What does an adb remote invocation look like? Anything like testing via ssh? I've vaguely pondered adding a passwordless ssh to remote machine and run the test there thing so I could set up an aboriginal linux powerpc instance, do a static cross compile build and run the tests remotely inside the emulated instance with the host's test script driving things. so that's the first problem... you give adb more credit than it deserves. of its many misfeatures, pertinent ones here are: it won't work in a pipe, I've wrapped stuff in pipe to pty translation before to make something that really cared about having a controlling terminal think it had one. I've also done ratelimiting for crap like qemu's powerpc serial emulation where incoming data bigger than the serial buffer size gets discarded. it won't return the exit status of the command it ran, You'll notice the test command isn't checking exit status either, which is why all the || echo yes and such. and it will add a \r to every line of output. | dos2unix i need to fix all of those, but none of them have become the most urgent fire yet, and no one's sent completely convincing patches. facebook wrote their own adb client (but it's an extended subset and doesn't support Windows [or the Mac?] so it's not really a replacement). Lovely. What's the adb transport, anyway? Toybox netcat has a -f mode that connects to a file instead of stdin/stdout, which I've used as half-assed microcom before. (I believe the help text describes how. A todo item is making a _proper_ microcom alias for it, but that involves writing stty first.) (Alas the recent netcat patch to change the command line option parsing broke server mode. I have a todo item to fix that before the release but I've been fighting with my aboriginal linux test environment for a couple weeks now and that's a blocker for doing a release of either because the lfs-bootstrap with current toybox on a current kernel is my main regression test.) anyway... something like this lets you run stuff like the pwd tests on a connected Android device. ($ANDROID_SERIAL is how you tell adb which Android device to talk to if there are several connected, without having to specify it on every command line. since you'd want to set that anyway before running the tests, that seemed reasonable.) diff --git a/scripts/runtest.sh b/scripts/runtest.sh index 8da1089..c4244a8 100644 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -83,8 +83,16 @@ testing() echo -ne $3 expected echo -ne $4 input - echo -ne $5 | eval $2 actual - RETVAL=$? + if [ -n $ANDROID_SERIAL ] + then +adb shell echo -ne '$5' | eval '$2' /data/local/tmp/actual ; echo $? /data/local/tmp/retval +adb pull /data/local/tmp/actual . +adb pull /data/local/tmp/retval . +RETVAL=`cat retval` + else +echo -ne $5 | eval $2 actual +RETVAL=$? + fi Is there a way to hook that up to the emulator? (I have two old phones with android I keep eyeing as test devices, but both are their respective ancient vendor installs from before I upgraded. My current Nexus 5 is t-mobile stock because I use it as a phone. Although the recent upgrade to version 5.0.1 has made me seriously reconsider that policy...) cmp expected actual /dev/null 21 if [ $? -ne 0 ] (Alas, a generic solution would also require a shared filesystem since the test script is doing mkdir and such to set up temporary files to test on. But I could probably botch something up...) ...but, yeah, this is a problem. any test script that does some file system setup is a problem. Did I mention that I have the first 1/3 or so of a 9p fileserver here, and that when I sat next to a Samba developer at texas linuxfest last year he told me that writing an smb server that _just_ served the newest protocol version in posix mode was probably a simpler protocol than 9p2000.L? (He sent me links and everything.) It's on the todo list. Also, Apple apparently wrote their own samba replacement as part of their great GPL purge: http://www.osnews.com/story/24572/Apple_Ditches_SAMBA_in_Favour_of_Homegrown_Replacement http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/ one possibility i've wondered about is factoring that out into a script of its own. this would have two advantages: 1. only one place to fix all this stuff for Android/ssh/whatever and 2. less boilerplate in each test script. if there was some known file system tree for commands to work on. Factoring which out into its own script, setting up a shared filesystem? The long-term solution is for me to get a proper shell on android, which means making toysh work well enough to build
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On Wed, Feb 18, 2015 at 11:10 AM, Rob Landley r...@landley.net wrote: On 01/30/2015 05:55 PM, enh wrote: On Fri, Jan 30, 2015 at 2:53 PM, Rob Landley r...@landley.net wrote: On 01/30/2015 01:56 AM, Yeongdeok Suh wrote: Hi, all, When I test toybox with toybox/tests/*.test scripts, I got many false FAILs from it. So, I tried to fix useradd.test file. What I fixed are as below. This week has been entirely eaten by $DAYJOB having me do kernel stuff. I hope to catch up a bit this weekend... 1. I added the checking routine at the head of file whether it is run by root. useradd.test should be PASSed only by root user. Existing tests (ifconfig, losetup, chgrp, chown) output SKIPPED instead of FAIL. (Not running the test as root isn't a failure per say, it just means we couldn't perform this test in this context. That way when we run make test to test all the commands enabled in the current config, we don't get spurious failures.) 2. I Separated 'userdel' from 'testing' syntax. in existing code, /testing adduser user_name (text) useradd toyTestUser $arg ||/ / grep '^toyTestUser:' /etc/passwd $arg test -d /home/toyTestUser / / *userdel toyTestUser $arg rm -rf /home/toyTestUser * echo 'yes' \/ / yes\n $pass / */userdel toyTestUser $arg rm -rf /home/toyTestUser/* is not related with useradd directly. But if userdel or rm occur error, this test case is FAILed. So I moved this part out of testing syntax. It's a cleanup step, yes. Could you share your opinion about this patch? useradd and userdel are still in pending, in part because Android uses a different userlist mechanism than /etc/passwd files and I need to do some research on the correct way to handle that. Oddly, enh (the Android guy) sent us this patch: https://www.mail-archive.com/toybox@lists.landley.net/msg01664.html Which reaches out and touches /etc/passwd for testing chown. It's on my list of things to think about in a lot more depth than I've had time to yet. oops! sorry to have caused confusion... right now i don't have any good way to run your tests on Android. i need to make a simon says-style mess with adb shell (at least at run time; hopefully not actually in the test scripts themselves), and haven't got round to doing that yet. I need to upgrade android toysh to the point where both the toybox build and the toybox test suite can run under the toybox shell. (Always a goal, just... kind of a big job.) I poked at the mirbsd guys online, but their license doesn't allow their code to be merged into toybox as is (yes, I'm a stickler for this sort of thing), and they have no interest in offering different license terms to the code. (Alas, would have saved some time to rebase and start fixing things up from there.) I've recently been poking at Aboriginal Linux (since part of my toybox release testing is building linux from scratch under that) and I recently found out that the bash 2.05b I've been using in my Aboriginal Linux project won't run the new parallel toybox build scripts (where new is like 6 months ago now). So the rebuild itself under itself thing is broken until I either fix up bash or get toysh to the point I can swap it in. so right now if i make a code change, i actually run the tests on the host (with either bionic or glibc, depending on what exactly i'm trying to test). I need to set up a bionic host test environment. I want to add that to my standard regression testing. Alas, its build is an android.mk and I dunno how to run that outside of the giant AOSP build blob. on the device i usually just rely on manual testing. (in this specific case, i rewrote the file using root and shell for Android.) You could also add a hook to scripts/runtest.sh replacing the eval on line 86 with a function similar to the do_loudly function starting on scripts/make.sh line 19. What does an adb remote invocation look like? Anything like testing via ssh? I've vaguely pondered adding a passwordly ssh to remote machine and run the test there thing so I could set up an aboriginal linux powerpc instance, do a static cross compile build and run the tests remotely inside the emulated instance with the host's test script driving things. so that's the first problem... you give adb more credit than it deserves. of its many misfeatures, pertinent ones here are: it won't work in a pipe, it won't return the exit status of the command it ran, and it will add a \r to every line of output. i need to fix all of those, but none of them have become the most urgent fire yet, and no one's sent completely convincing patches. facebook wrote their own adb client (but it's an extended subset and doesn't support Windows [or the Mac?] so it's not really a replacement). anyway... something like this lets you run stuff like the pwd tests on a connected Android device. ($ANDROID_SERIAL is how you tell adb which Android device to talk to if there are several connected, without
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On 01/30/2015 05:55 PM, enh wrote: On Fri, Jan 30, 2015 at 2:53 PM, Rob Landley r...@landley.net wrote: On 01/30/2015 01:56 AM, Yeongdeok Suh wrote: Hi, all, When I test toybox with toybox/tests/*.test scripts, I got many false FAILs from it. So, I tried to fix useradd.test file. What I fixed are as below. This week has been entirely eaten by $DAYJOB having me do kernel stuff. I hope to catch up a bit this weekend... 1. I added the checking routine at the head of file whether it is run by root. useradd.test should be PASSed only by root user. Existing tests (ifconfig, losetup, chgrp, chown) output SKIPPED instead of FAIL. (Not running the test as root isn't a failure per say, it just means we couldn't perform this test in this context. That way when we run make test to test all the commands enabled in the current config, we don't get spurious failures.) 2. I Separated 'userdel' from 'testing' syntax. in existing code, /testing adduser user_name (text) useradd toyTestUser $arg ||/ / grep '^toyTestUser:' /etc/passwd $arg test -d /home/toyTestUser / / *userdel toyTestUser $arg rm -rf /home/toyTestUser * echo 'yes' \/ / yes\n $pass / */userdel toyTestUser $arg rm -rf /home/toyTestUser/* is not related with useradd directly. But if userdel or rm occur error, this test case is FAILed. So I moved this part out of testing syntax. It's a cleanup step, yes. Could you share your opinion about this patch? useradd and userdel are still in pending, in part because Android uses a different userlist mechanism than /etc/passwd files and I need to do some research on the correct way to handle that. Oddly, enh (the Android guy) sent us this patch: https://www.mail-archive.com/toybox@lists.landley.net/msg01664.html Which reaches out and touches /etc/passwd for testing chown. It's on my list of things to think about in a lot more depth than I've had time to yet. oops! sorry to have caused confusion... right now i don't have any good way to run your tests on Android. i need to make a simon says-style mess with adb shell (at least at run time; hopefully not actually in the test scripts themselves), and haven't got round to doing that yet. I need to upgrade android toysh to the point where both the toybox build and the toybox test suite can run under the toybox shell. (Always a goal, just... kind of a big job.) I poked at the mirbsd guys online, but their license doesn't allow their code to be merged into toybox as is (yes, I'm a stickler for this sort of thing), and they have no interest in offering different license terms to the code. (Alas, would have saved some time to rebase and start fixing things up from there.) I've recently been poking at Aboriginal Linux (since part of my toybox release testing is building linux from scratch under that) and I recently found out that the bash 2.05b I've been using in my Aboriginal Linux project won't run the new parallel toybox build scripts (where new is like 6 months ago now). So the rebuild itself under itself thing is broken until I either fix up bash or get toysh to the point I can swap it in. so right now if i make a code change, i actually run the tests on the host (with either bionic or glibc, depending on what exactly i'm trying to test). I need to set up a bionic host test environment. I want to add that to my standard regression testing. Alas, its build is an android.mk and I dunno how to run that outside of the giant AOSP build blob. on the device i usually just rely on manual testing. (in this specific case, i rewrote the file using root and shell for Android.) You could also add a hook to scripts/runtest.sh replacing the eval on line 86 with a function similar to the do_loudly function starting on scripts/make.sh line 19. What does an adb remote invocation look like? Anything like testing via ssh? I've vaguely pondered adding a passwordly ssh to remote machine and run the test there thing so I could set up an aboriginal linux powerpc instance, do a static cross compile build and run the tests remotely inside the emulated instance with the host's test script driving things. (Alas, a generic solution would also require a shared filesystem since the test script is doing mkdir and such to set up temporary files to test on. But I could probably botch something up...) as i've said, Android doesn't have /etc/passwd (or /etc/group), and it doesn't have setpwent/getpwent/endpwent (or equivalents). you *can* do uid/gid or name lookups though, because they do make some degree of sense. (so id(1) works.) i've considered implementing getpwent so that it would cycle through the well known users, but we don't actually have an example of anything that would use it, and it's really not obvious that we'd be doing anyone any favors --- code calling getpwent that wants to run on Android needs to think long and hard about exactly what it means by that, and whether it makes any sense at all. This I'm
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
2015-01-31 7:53 GMT+09:00 Rob Landley r...@landley.net: On 01/30/2015 01:56 AM, Yeongdeok Suh wrote: Hi, all, When I test toybox with toybox/tests/*.test scripts, I got many false FAILs from it. So, I tried to fix useradd.test file. What I fixed are as below. This week has been entirely eaten by $DAYJOB having me do kernel stuff. I hope to catch up a bit this weekend... I appreciate your efforts:) I fixed some thing what you said. 1. I added the checking routine at the head of file whether it is run by root. useradd.test should be PASSed only by root user. Existing tests (ifconfig, losetup, chgrp, chown) output SKIPPED instead of FAIL. (Not running the test as root isn't a failure per say, it just means we couldn't perform this test in this context. That way when we run make test to test all the commands enabled in the current config, we don't get spurious failures.) I fixed the FAIL to SKIPPED 2. I Separated 'userdel' from 'testing' syntax. in existing code, /testing adduser user_name (text) useradd toyTestUser $arg ||/ / grep '^toyTestUser:' /etc/passwd $arg test -d /home/toyTestUser / / *userdel toyTestUser $arg rm -rf /home/toyTestUser * echo 'yes' \/ / yes\n $pass / */userdel toyTestUser $arg rm -rf /home/toyTestUser/* is not related with useradd directly. But if userdel or rm occur error, this test case is FAILed. So I moved this part out of testing syntax. It's a cleanup step, yes. Could you share your opinion about this patch? useradd and userdel are still in pending, in part because Android uses a different userlist mechanism than /etc/passwd files and I need to do some research on the correct way to handle that. Oddly, enh (the Android guy) sent us this patch: https://www.mail-archive.com/toybox@lists.landley.net/msg01664.html Which reaches out and touches /etc/passwd for testing chown. It's on my list of things to think about in a lot more depth than I've had time to yet. It is good idea. But I didn't apply it to new patch. I gonna test it on my ARM machines too. There are some minor hiccups with your patch ( redirects both stdout and stderr, and then you redirect stderr again?) but it's better than what was there. I'll probably apply it this weekend. (Bured by $DAYJOB right now...) Oops! I fixed them to $args (/dev/null). Yeongdeok Thanks, Rob Thanks, Yeongdeok 0001-Separate-userdel-from-testing-syntax.patch Description: Binary data ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On 01/30/2015 01:56 AM, Yeongdeok Suh wrote: Hi, all, When I test toybox with toybox/tests/*.test scripts, I got many false FAILs from it. So, I tried to fix useradd.test file. What I fixed are as below. This week has been entirely eaten by $DAYJOB having me do kernel stuff. I hope to catch up a bit this weekend... 1. I added the checking routine at the head of file whether it is run by root. useradd.test should be PASSed only by root user. Existing tests (ifconfig, losetup, chgrp, chown) output SKIPPED instead of FAIL. (Not running the test as root isn't a failure per say, it just means we couldn't perform this test in this context. That way when we run make test to test all the commands enabled in the current config, we don't get spurious failures.) 2. I Separated 'userdel' from 'testing' syntax. in existing code, /testing adduser user_name (text) useradd toyTestUser $arg ||/ / grep '^toyTestUser:' /etc/passwd $arg test -d /home/toyTestUser / / *userdel toyTestUser $arg rm -rf /home/toyTestUser * echo 'yes' \/ / yes\n $pass / */userdel toyTestUser $arg rm -rf /home/toyTestUser/* is not related with useradd directly. But if userdel or rm occur error, this test case is FAILed. So I moved this part out of testing syntax. It's a cleanup step, yes. Could you share your opinion about this patch? useradd and userdel are still in pending, in part because Android uses a different userlist mechanism than /etc/passwd files and I need to do some research on the correct way to handle that. Oddly, enh (the Android guy) sent us this patch: https://www.mail-archive.com/toybox@lists.landley.net/msg01664.html Which reaches out and touches /etc/passwd for testing chown. It's on my list of things to think about in a lot more depth than I've had time to yet. There are some minor hiccups with your patch ( redirects both stdout and stderr, and then you redirect stderr again?) but it's better than what was there. I'll probably apply it this weekend. (Bured by $DAYJOB right now...) Yeongdeok Thanks, Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On Fri, Jan 30, 2015 at 03:55:02PM -0800, enh wrote: as i've said, Android doesn't have /etc/passwd (or /etc/group), and it doesn't have setpwent/getpwent/endpwent (or equivalents). you *can* do uid/gid or name lookups though, because they do make some degree of sense. (so id(1) works.) i've considered implementing getpwent so that it would cycle through the well known users, but we don't actually have an example of anything that would use it, and it's really not obvious that we'd be doing anyone any favors --- code calling getpwent that wants to run on Android needs to think long and hard about exactly what it means by that, and whether it makes any sense at all. The main application I've seen that makes _any_ sense is tab-completion of usernames in the shell. the fact that Android tends to be pretty locked down with SELinux means it's going to be tricky to test a lot of toybox things, but getting to a point where i can run the test suite is definitely a goal. just not a priority (because i can run the tests on the desktop with bionic). Is there any guide to getting bionic built and working on a desktop system, short of doing a complete android build? I tried a while back with the gentoobionic repo which was setup to work without the android build system, but didn't get anywhere with it. This is not something I have a lot of time to spend on, but I'd like it if I could get something working to evaluate differences between musl and bionic. Rich ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On Fri, Jan 30, 2015 at 5:41 PM, Rich Felker dal...@libc.org wrote: On Fri, Jan 30, 2015 at 03:55:02PM -0800, enh wrote: as i've said, Android doesn't have /etc/passwd (or /etc/group), and it doesn't have setpwent/getpwent/endpwent (or equivalents). you *can* do uid/gid or name lookups though, because they do make some degree of sense. (so id(1) works.) i've considered implementing getpwent so that it would cycle through the well known users, but we don't actually have an example of anything that would use it, and it's really not obvious that we'd be doing anyone any favors --- code calling getpwent that wants to run on Android needs to think long and hard about exactly what it means by that, and whether it makes any sense at all. The main application I've seen that makes _any_ sense is tab-completion of usernames in the shell. yeah, which wouldn't be very useful on a system that's so locked down by SELinux that users are very much not interchangeable. the fact that Android tends to be pretty locked down with SELinux means it's going to be tricky to test a lot of toybox things, but getting to a point where i can run the test suite is definitely a goal. just not a priority (because i can run the tests on the desktop with bionic). Is there any guide to getting bionic built and working on a desktop system, short of doing a complete android build? I tried a while back with the gentoobionic repo which was setup to work without the android build system, but didn't get anywhere with it. This is not something I have a lot of time to spend on, but I'd like it if I could get something working to evaluate differences between musl and bionic. not really because we always need the whole tree anyway, but cd bionic ; mma -j32 is probably a good place to start to only build the dependencies. (this is after the usual source build/envsetup.sh ; lunch aosp_x86_64-eng.) there's a build target in bionic/tests to run the tests on the host that will set up /system so that Android binaries will run (because the toolchain hardcodes the linker's path, and that's /system/bin/linker64). everything else can be diverted with environment variables, which that build target also does. details of how to submit patches is at https://source.android.com/source/submit-patches.html :-) Rich ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net
Re: [Toybox] [PATCH] Seperate 'userdel' from testing syntax
On Fri, Jan 30, 2015 at 2:53 PM, Rob Landley r...@landley.net wrote: On 01/30/2015 01:56 AM, Yeongdeok Suh wrote: Hi, all, When I test toybox with toybox/tests/*.test scripts, I got many false FAILs from it. So, I tried to fix useradd.test file. What I fixed are as below. This week has been entirely eaten by $DAYJOB having me do kernel stuff. I hope to catch up a bit this weekend... 1. I added the checking routine at the head of file whether it is run by root. useradd.test should be PASSed only by root user. Existing tests (ifconfig, losetup, chgrp, chown) output SKIPPED instead of FAIL. (Not running the test as root isn't a failure per say, it just means we couldn't perform this test in this context. That way when we run make test to test all the commands enabled in the current config, we don't get spurious failures.) 2. I Separated 'userdel' from 'testing' syntax. in existing code, /testing adduser user_name (text) useradd toyTestUser $arg ||/ / grep '^toyTestUser:' /etc/passwd $arg test -d /home/toyTestUser / / *userdel toyTestUser $arg rm -rf /home/toyTestUser * echo 'yes' \/ / yes\n $pass / */userdel toyTestUser $arg rm -rf /home/toyTestUser/* is not related with useradd directly. But if userdel or rm occur error, this test case is FAILed. So I moved this part out of testing syntax. It's a cleanup step, yes. Could you share your opinion about this patch? useradd and userdel are still in pending, in part because Android uses a different userlist mechanism than /etc/passwd files and I need to do some research on the correct way to handle that. Oddly, enh (the Android guy) sent us this patch: https://www.mail-archive.com/toybox@lists.landley.net/msg01664.html Which reaches out and touches /etc/passwd for testing chown. It's on my list of things to think about in a lot more depth than I've had time to yet. oops! sorry to have caused confusion... right now i don't have any good way to run your tests on Android. i need to make a simon says-style mess with adb shell (at least at run time; hopefully not actually in the test scripts themselves), and haven't got round to doing that yet. so right now if i make a code change, i actually run the tests on the host (with either bionic or glibc, depending on what exactly i'm trying to test). on the device i usually just rely on manual testing. (in this specific case, i rewrote the file using root and shell for Android.) as i've said, Android doesn't have /etc/passwd (or /etc/group), and it doesn't have setpwent/getpwent/endpwent (or equivalents). you *can* do uid/gid or name lookups though, because they do make some degree of sense. (so id(1) works.) i've considered implementing getpwent so that it would cycle through the well known users, but we don't actually have an example of anything that would use it, and it's really not obvious that we'd be doing anyone any favors --- code calling getpwent that wants to run on Android needs to think long and hard about exactly what it means by that, and whether it makes any sense at all. so going back to your in pending ... because Android, i think you should just ignore us as far as adduser/userdel are concerned. i don't think there's anything useful you can do. the fact that Android tends to be pretty locked down with SELinux means it's going to be tricky to test a lot of toybox things, but getting to a point where i can run the test suite is definitely a goal. just not a priority (because i can run the tests on the desktop with bionic). There are some minor hiccups with your patch ( redirects both stdout and stderr, and then you redirect stderr again?) but it's better than what was there. I'll probably apply it this weekend. (Bured by $DAYJOB right now...) Yeongdeok Thanks, Rob ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net