]> granicus.if.org Git - strace/commitdiff
umovestr3.test: extend test coverage
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 17 May 2016 17:53:40 +0000 (17:53 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 18 May 2016 09:26:01 +0000 (09:26 +0000)
* tests/umovestr3.c: Include <sys/param.h>.
(main): Test with each number between PATH_MAX-1 and 0.

tests/umovestr3.c

index c0a62cd9df4ca6d482f634ba2814221643c69808..7b2e63888651964b598a33dd28407249b5516190 100644 (file)
 #include "tests.h"
 #include <stdio.h>
 #include <unistd.h>
+#include <sys/param.h>
 
 int
 main(void)
 {
        (void) tail_alloc(1);
-       const unsigned int size = 8;
-       const char *const p = tail_alloc(size);
+       const unsigned int size = PATH_MAX - 1;
+       const char *p = tail_alloc(size);
        const char *const efault = p + size;
        (void) tail_alloc(1);
+       (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());
+       for (; p <= efault; ++p) {
+               int rc = chdir(p);
+               printf("chdir(%p) = %d %s (%m)\n", p, rc, errno2name());
+       }
 
        puts("+++ exited with 0 +++");
        return 0;