]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
none/tests: Add test for bz414565.
authorAlexandra Hájková <ahajkova@redhat.com>
Mon, 16 Dec 2019 14:58:26 +0000 (15:58 +0100)
committerMark Wielaard <mark@klomp.org>
Sun, 22 Dec 2019 14:52:13 +0000 (15:52 +0100)
Integrate the test case written by Nikola Milutinovic to the
testsuite. (https://bugs.kde.org/show_bug.cgi?id=414565)

none/tests/Makefile.am
none/tests/sigprocmask.c [new file with mode: 0644]
none/tests/sigprocmask.stderr.exp [new file with mode: 0644]
none/tests/sigprocmask.vgtest [new file with mode: 0644]

index b63c8d97c37fdf1d040ae988ce86cee8a913f8ae..e2b01876644139ca8fb8529236075c2c2d2c9626 100644 (file)
@@ -203,7 +203,9 @@ EXTRA_DIST = \
        unit_debuglog.stderr.exp unit_debuglog.vgtest \
        vgprintf.stderr.exp vgprintf.vgtest \
        vgprintf_nvalgrind.stderr.exp vgprintf_nvalgrind.vgtest \
-       process_vm_readv_writev.stderr.exp process_vm_readv_writev.vgtest
+       process_vm_readv_writev.stderr.exp process_vm_readv_writev.vgtest \
+       sigprocmask.stderr.exp sigprocmask.vgtest
+
 
 check_PROGRAMS = \
        args \
@@ -251,7 +253,8 @@ check_PROGRAMS = \
        vgprintf_nvalgrind \
        coolo_sigaction \
        gxx304 \
-       process_vm_readv_writev
+       process_vm_readv_writev \
+       sigprocmask
 
 if HAVE_NESTED_FUNCTIONS
    check_PROGRAMS += nestedfns
diff --git a/none/tests/sigprocmask.c b/none/tests/sigprocmask.c
new file mode 100644 (file)
index 0000000..4cb77c5
--- /dev/null
@@ -0,0 +1,26 @@
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+
+#include <errno.h>
+
+int main() {
+
+   sigset_t oldset;
+
+   const int TRASH = 123;
+
+   // TRASH variable, that represents HOW parameter, should be ignored in this case
+   // Taken from: http://man7.org/linux/man-pages/man2/sigprocmask.2.html :
+   //    If set is NULL, then the signal mask is unchanged (i.e., HOW is
+   //    ignored), but the current value of the signal mask is nevertheless
+   //    returned in oldset (if it is not NULL).
+   if (sigprocmask(TRASH, NULL, &oldset) == 0) {
+       exit(EXIT_FAILURE);
+   } else {
+       exit(EXIT_SUCCESS);
+   }
+
+}
diff --git a/none/tests/sigprocmask.stderr.exp b/none/tests/sigprocmask.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/none/tests/sigprocmask.vgtest b/none/tests/sigprocmask.vgtest
new file mode 100644 (file)
index 0000000..e033128
--- /dev/null
@@ -0,0 +1,2 @@
+prog: sigprocmask
+vgopts: -q