3 // RUN: %clang_pgogen -o %t.exe %s
4 // RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe %t.bad 2>&1 | FileCheck %s
6 // CHECK: __llvm_profile_set_file_object(fd={{[0-9]+}}) not supported
7 // CHECK: Profile data not written to file: already written.
11 extern int __llvm_profile_is_continuous_mode_enabled(void);
12 extern void __llvm_profile_set_file_object(FILE *, int);
13 extern int __llvm_profile_write_file(void);
15 int main(int argc
, char **argv
) {
16 if (!__llvm_profile_is_continuous_mode_enabled())
19 FILE *f
= fopen(argv
[1], "a+b");
23 __llvm_profile_set_file_object(f
, 0); // Try to set the file to "%t.bad".
25 if (__llvm_profile_write_file() != 0)
28 f
= fopen(argv
[1], "r");
32 fseek(f
, 0, SEEK_END
);
33 return ftell(f
); // Check that the "%t.bad" is empty.