Hi,

Ptrace06 has lots of issues. It fails to build on IA-64, unable to compile on 
earlier Kernels
(more details on those two issues could be found on previous threads) and there 
is new issue I
have just spotted.

In spawn_ptrace_child.h,

static void make_a_baby(int argc, char *argv[])
{
        if (argc > 1 && !strcmp(argv[1], "child")) {
                /* if we're the child, just sit around doing nothing */
                while (1)
                        sleep(1);
        }

        /* ptrace() stuff will fail for us if the child dies */
        signal(SIGCHLD, SIG_IGN);

        pid = vfork();
        if (pid == -1) {
                tst_resm(TFAIL, "vfork() failed");
                tst_exit();
        } else if (pid)
                return;

        errno = 0;
        long ret = ptrace(PTRACE_TRACEME, 0, NULL, NULL);
        if (ret && errno) {
                tst_resm(TFAIL, "PTRACE_TRACEME failed");
                tst_exit();
        }

        execlp(argv[0], argv[0], "child", NULL);
        tst_resm(TFAIL, "execlp() failed");
        tst_exit();
}

The parent returns from the function in which vfork() was called. As the 
results, the test result
is random on x86-64,

ptrace06    1  PASS  :  ptrace(PEEKDATA, ..., (nil), (nil)) failed as expected

or

ptrace06    1  FAIL:  ptrace(PEEKDATA, ..., (nil), (nil)) expected errno EIO or 
EFAULT; actual: No
such process

or

ptrace06    1  FAIL:  ptrace(PEEKDATA, ..., (nil), (nil)) returned 0 instead of 
-1

According vfork() manpage, the code is does not look right.

"The vfork() function has the same effect as fork(2), except that the behavior 
is undefined if 
the process created  by  vfork()  either modifies  any  data  other than a 
variable of type pid_t
used to store the return value from vfork(), or returns from the function in 
which vfork() was
called,"

Also, it leaves lots of processes after the test completes.

qcai      4503  0.0  0.0   4092   408 pts/8    S    01:22   0:00 ./ptrace06 
child
qcai      4541  0.0  0.0   4092   408 pts/8    S    01:23   0:00 ./ptrace06 
child
qcai      4584  0.0  0.0   4092   408 pts/8    S    01:23   0:00 ./ptrace06 
child
qcai      4606  0.0  0.0   4092   404 pts/8    S    01:23   0:00 ./ptrace06 
child

The test has been disabled in Makefile at the moment, but I would like to 
discuss how we could
handle the similar case in the future. In this case, it is unnecessary to 
remove it from CVS
entirely, but it is kind of untidy and confusion to users to leave in the test 
directory, but
never been compiled. How about to create a separate directory 
(testcases/working_in_progress?) to
move all those broken test code there, and each of them has an associate file 
to document why it
is here and what need to be done to move it to the test directory it should 
belong?

Cai Qian


-------------------------------------------------------------------------
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