uClinux vs. Crackerjack tests
RFC 1/1 uClinux vs. Crackerjack tests
Hello,
the recently introduced tests from Crackerjack use some subroutines that use fork(). However, according to the documentation, fork is not available on uClinux, and LTP seems to support this. Although I haven't noticed any complaints to the functionality of the tests on uClinux, I wonder whether they actually work.
I wonder whether simple functions executed in the child process couldn't be replaced by some shell code, like this, to make them work on uClinux:
(quoted diff) +0 -0
b/testcases/kernel/syscalls/utils/common_j_h.c
index c460d85..8e7dbf8 100644
testcases/kernel/syscalls/utils/common_j_h.c +5 -1
@@ -117,15 +117,25 @@ static void sigterm_handler(int sig)*/ pid_t create_sig_proc (unsigned long usec,int sig,unsigned count) { -pid_t pid, cpid; +pid_t pid =getpid (), cpid; +#ifdef UCLINUX +char buffer[256 ]; + + snprintf(buffer, 256, "COUNT=%d TIME=%ld SIG=%d; while [
$(COUNT-=1) -gt 0 ]; do sleep $TIME; kill -$SIG $PPID; done",
+ count, (usec+999999)/1000000,
sig);
+ if((cpid = vfork()) == 0) {
+ execlp("sh", "-c", buffer, (void*)0);
+ _exit(1);
+ }
- pid = getpid();
+#else
WITH_SIGNALS_BLOCKED(
if((cpid = fork()) == 0) {
tst_sig(NOFORK, SIG_DFL, NULL);
signal(SIGTERM, sigterm_handler);
}
);
+#endif
switch (cpid) {
case 0:
while(count-- > 0) {It isn't an exact replacement (the sleep interval granularity is 1 second in the shell version), but this parameter isn't crucial for the function of the tests that use it. It would save us an extra binary or altering all the tests that use this function.
Regards
Jiri Palecek
Signature · 12 lines
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list