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

Reply via email to