diff options
Diffstat (limited to 'compiler-rt/test/msan/Linux/glob_nomatch.cpp')
| -rw-r--r-- | compiler-rt/test/msan/Linux/glob_nomatch.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler-rt/test/msan/Linux/glob_nomatch.cpp b/compiler-rt/test/msan/Linux/glob_nomatch.cpp new file mode 100644 index 00000000000..fa132c81372 --- /dev/null +++ b/compiler-rt/test/msan/Linux/glob_nomatch.cpp @@ -0,0 +1,21 @@ +// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p +// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p + +#include <assert.h> +#include <glob.h> +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char *argv[]) { + assert(argc == 2); + char buf[1024]; + snprintf(buf, sizeof(buf), "%s/%s", argv[1], "glob_test_root/*c"); + + glob_t globbuf; + int res = glob(buf, 0, 0, &globbuf); + assert(res == GLOB_NOMATCH); + assert(globbuf.gl_pathc == 0); + if (globbuf.gl_pathv == 0) + exit(0); + return 0; +} |

