Home | History | Annotate | Download | only in Posix
      1 // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
      2 // XFAIL: android
      3 //
      4 // RUN: %clangxx_asan -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s
      5 // RUN: %clangxx_asan -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s
      6 // XFAIL: arm-linux-gnueabi
      7 
      8 #include <assert.h>
      9 #include <glob.h>
     10 #include <stdio.h>
     11 #include <string.h>
     12 #include <errno.h>
     13 #include <string>
     14 
     15 
     16 int main(int argc, char *argv[]) {
     17   std::string path = argv[1];
     18   std::string pattern = path + "/glob_test_root/*a";
     19   printf("pattern: %s\n", pattern.c_str());
     20 
     21   glob_t globbuf;
     22   int res = glob(pattern.c_str(), 0, 0, &globbuf);
     23 
     24   printf("%d %s\n", errno, strerror(errno));
     25   assert(res == 0);
     26   assert(globbuf.gl_pathc == 2);
     27   printf("%zu\n", strlen(globbuf.gl_pathv[0]));
     28   printf("%zu\n", strlen(globbuf.gl_pathv[1]));
     29   globfree(&globbuf);
     30   printf("PASS\n");
     31   // CHECK: PASS
     32   return 0;
     33 }
     34