[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / profile / ContinuousSyncMode / set-file-object.c
blob4eea4575313dafa1c5fe33a963dbd7f6e5594bb9
1 // REQUIRES: darwin
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.
9 #include <stdio.h>
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())
17 return 1;
19 FILE *f = fopen(argv[1], "a+b");
20 if (!f)
21 return 1;
23 __llvm_profile_set_file_object(f, 0); // Try to set the file to "%t.bad".
25 if (__llvm_profile_write_file() != 0)
26 return 1;
28 f = fopen(argv[1], "r");
29 if (!f)
30 return 1;
32 fseek(f, 0, SEEK_END);
33 return ftell(f); // Check that the "%t.bad" is empty.