On Wed, Nov 12, 2008 at 11:40 PM, Yan Li wrote:
> On Wed, Nov 12, 2008 at 01:10:13PM -0500, Mike Frysinger wrote:
>> system() isnt a syscall, so there wouldnt be a test case in the normal
>> tree (nor does it make sense to have one there).  probably the better
>> place to put it is the open posix testsuite:
>> http://posixtest.sourceforge.net/
>
> The reason I asked this is due to that I saw malloc() test cases, so
> wondered whether there're other test cases for non-syscall.

the malloc() tests get heavy into making sure the kernel can handle
different memory tress cases.  the memory functions themselves tend to
be pretty close to the kernel as it mucks around with the memory space
the kernel has for the process.  system() just passes a string to a
shell.

> Also I have checked glibc and it didn't contain such a test case for
> system() either.

it's a bit hard to test since the only thing you can validate is that
the string is passed to a shell and the exit value is correct.  sounds
like three simple tests:
for (i = 0; i < 127; ++i) {
  char sys[10];
  sprintf(sys, "exit %i", i);
  assert(system(sys) == i);
}
assert(system("rm -f foo") == 0);
assert(open("foo", O_RDONLY) == -1);
assert(system("touch foo") == 0);
assert(open("foo", O_RDONLY) != -1);
-mike

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to