Skip to content

Commit

Permalink
[NFC][sanitizer] Don't use FileCheck in test
Browse files Browse the repository at this point in the history
`assert` is enough.
  • Loading branch information
vitalybuka committed Sep 22, 2024
1 parent 3ad3f05 commit e5d174c
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
// RUN: %clangxx -O1 %s -o %t && %run %t %t.tmp 2>&1 | FileCheck %s
// RUN: %clangxx -O1 %s -o %t && %run %t %t.tmp

#include <stdio.h>
#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>

int main(int argc, char *argv[]) {
fprintf(stderr, "Hello world.\n");
assert(argv[1]);
unlink(argv[1]);
int fd = open(argv[1], O_RDWR | O_CREAT, 0600);
assert(fd != -1);
struct stat info;
int result = fstat(fd, &info);
fprintf(stderr, "permissions = 0%o\n", info.st_mode & ~S_IFMT);
assert((info.st_mode & ~S_IFMT) == 0600);
assert(result == 0);
close(fd);
fprintf(stderr, "Done.\n");
}

// CHECK: Hello world.
// CHECK: permissions = 0600
// CHECK: Done.

0 comments on commit e5d174c

Please sign in to comment.