public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: "Jiří Paleček" <jpalecek@web.de>
To: "ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>
Subject: [LTP] [RFC] uClinux vs. Crackerjack tests
Date: Tue, 06 Oct 2009 11:50:02 +0200	[thread overview]
Message-ID: <op.u1dhh1gru2flwt@debian> (raw)

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:

diff --git a/testcases/kernel/syscalls/utils/common_j_h.c
b/testcases/kernel/syscalls/utils/common_j_h.c
index c460d85..8e7dbf8 100644
--- a/testcases/kernel/syscalls/utils/common_j_h.c
+++ b/testcases/kernel/syscalls/utils/common_j_h.c
@@ -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

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

                 reply	other threads:[~2009-10-06  9:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.u1dhh1gru2flwt@debian \
    --to=jpalecek@web.de \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox