Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/gen/exect Add check in t_exect_null to verify...



details:   https://anonhg.NetBSD.org/src/rev/c3d34d13ee1d
branches:  trunk
changeset: 349385:c3d34d13ee1d
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Dec 09 06:47:48 2016 +0000

description:
Add check in t_exect_null to verify that SIGTRAP was emitted only once

Currently this test fails on amd64.

PR port-amd64/51700
    exect(NULL,NULL,NULL) generates 15859 times SIGTRAP on amd64

On FreeBSD/amd64 this tests passes correctly.

Sponsored by <The NetBSD Foundation>

diffstat:

 tests/lib/libc/gen/exect/t_exect.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r db46150854c2 -r c3d34d13ee1d tests/lib/libc/gen/exect/t_exect.c
--- a/tests/lib/libc/gen/exect/t_exect.c        Fri Dec 09 06:12:03 2016 +0000
+++ b/tests/lib/libc/gen/exect/t_exect.c        Fri Dec 09 06:47:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_exect.c,v 1.2 2016/12/09 06:12:02 kamil Exp $        */
+/*     $NetBSD: t_exect.c,v 1.3 2016/12/09 06:47:48 kamil Exp $        */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -42,17 +42,26 @@
            "Tests an empty exect(2) executing");
 }
 
+static sig_atomic_t caught = 0;
+
 static void
 sigtrap_handler(int sig, siginfo_t *info, void *ctx)
 {
        ATF_REQUIRE_EQ(sig, SIGTRAP);
        ATF_REQUIRE_EQ(info->si_code, TRAP_TRACE);
+
+       ++caught;
 }
 
 ATF_TC_BODY(t_exect_null, tc)
 {
        struct sigaction act;
 
+       /*
+        * exect(NULL,NULL,NULL) generates 15859 times SIGTRAP on amd64
+        */
+       atf_tc_expect_fail("PR port-amd64/51700");
+
        ATF_REQUIRE(sigemptyset(&act.sa_mask) == 0);
        act.sa_sigaction = sigtrap_handler;
        act.sa_flags = SA_SIGINFO;
@@ -60,6 +69,9 @@
        ATF_REQUIRE(sigaction(SIGTRAP, &act, 0) == 0);
 
        ATF_REQUIRE_ERRNO(EFAULT, exect(NULL, NULL, NULL) == -1);
+
+       ATF_REQUIRE_EQ_MSG(caught, 1, "expected caught (1) != received (%d)",
+           caught);
 }
 
 ATF_TP_ADD_TCS(tp)



Home | Main Index | Thread Index | Old Index