]> granicus.if.org Git - strace/commitdiff
tests: extend test coverage of umovestr short read condition
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 27 Apr 2016 00:08:06 +0000 (00:08 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 27 Apr 2016 01:32:21 +0000 (01:32 +0000)
* tests/umovestr3.c: New file.
* tests/umovestr3.test: New test.
* tests/.gitignore: Add umovestr3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr3.test.

tests/.gitignore
tests/Makefile.am
tests/umovestr3.c [new file with mode: 0644]
tests/umovestr3.test [new file with mode: 0755]

index 8a1e65a33e28837f7e2078036edd72d26298ee6b..2d9c4ab8af0e1387d1a9a2a43282dca40a5525c0 100644 (file)
@@ -230,6 +230,7 @@ umount
 umount2
 umovestr
 umovestr2
+umovestr3
 uname
 unix-pair-send-recv
 unlink
index 8542aa0adfe49f10d0cd94ce90fde28cfd1b8460..af667ee9d70ed4996db13681f05b82ba0613683d 100644 (file)
@@ -282,6 +282,7 @@ check_PROGRAMS = \
        umount2 \
        umovestr \
        umovestr2 \
+       umovestr3 \
        uname \
        unix-pair-send-recv \
        unlink \
@@ -543,6 +544,7 @@ DECODER_TESTS = \
        umount2.test \
        umovestr.test \
        umovestr2.test \
+       umovestr3.test \
        uname.test \
        unlink.test \
        unlinkat.test \
diff --git a/tests/umovestr3.c b/tests/umovestr3.c
new file mode 100644 (file)
index 0000000..b4daae0
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+       const unsigned int size = 8;
+       const char *const p = tail_alloc(size);
+       const char *const efault = p + size;
+       (void) tail_alloc(1);
+
+       int rc = chdir(p);
+       printf("chdir(%p) = %d %s (%m)\n", p, rc, errno2name());
+
+       rc = chdir(efault);
+       printf("chdir(%p) = %d %s (%m)\n", efault, rc, errno2name());
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
diff --git a/tests/umovestr3.test b/tests/umovestr3.test
new file mode 100755 (executable)
index 0000000..d5be283
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# yet another umovestr short read test
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14 -e trace=chdir