]> git.proxmox.com Git - rustc.git/blame - src/libcompiler_builtins/compiler-rt/test/asan/TestCases/Posix/glob.cc
New upstream version 1.25.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / asan / TestCases / Posix / glob.cc
CommitLineData
92a42be0
SL
1// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
2// XFAIL: android
2c00a5a8 3// UNSUPPORTED: ios
92a42be0 4//
1a4d82fc
JJ
5// RUN: %clangxx_asan -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s
6// RUN: %clangxx_asan -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s
92a42be0 7// XFAIL: arm-linux-gnueabi
1a4d82fc
JJ
8
9#include <assert.h>
10#include <glob.h>
11#include <stdio.h>
12#include <string.h>
13#include <errno.h>
14#include <string>
15
16
17int main(int argc, char *argv[]) {
18 std::string path = argv[1];
19 std::string pattern = path + "/glob_test_root/*a";
20 printf("pattern: %s\n", pattern.c_str());
21
22 glob_t globbuf;
23 int res = glob(pattern.c_str(), 0, 0, &globbuf);
24
25 printf("%d %s\n", errno, strerror(errno));
26 assert(res == 0);
27 assert(globbuf.gl_pathc == 2);
28 printf("%zu\n", strlen(globbuf.gl_pathv[0]));
29 printf("%zu\n", strlen(globbuf.gl_pathv[1]));
30 globfree(&globbuf);
31 printf("PASS\n");
32 // CHECK: PASS
33 return 0;
34}