brintos

brintos / llvm-project-archived public Read only

0
0
Text · 871 B · 16b4ace Raw
34 lines · cpp
1// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=3162// XFAIL: android3// UNSUPPORTED: ios4//5// RUN: %clangxx_asan -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s6// RUN: %clangxx_asan -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s7 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 16int 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: PASS32  return 0;33}34