Only replace the dump file opening function in test

This commit is contained in:
Yinan Zhang
2020-03-17 11:05:07 -07:00
parent d8cea87562
commit f307b25804
6 changed files with 24 additions and 19 deletions

View File

@@ -6,11 +6,11 @@
#define BT_COUNT_CHECK_INTERVAL 5
static int
prof_dump_open_intercept(bool propagate_err, const char *filename) {
prof_dump_open_file_intercept(const char *filename, int mode) {
int fd;
fd = open("/dev/null", O_WRONLY);
expect_d_ne(fd, -1, "Unexpected open() failure");
assert_d_ne(fd, -1, "Unexpected open() failure");
return fd;
}
@@ -62,7 +62,7 @@ TEST_BEGIN(test_idump) {
sizeof(active)), 0,
"Unexpected mallctl failure while activating profiling");
prof_dump_open = prof_dump_open_intercept;
prof_dump_open_file = prof_dump_open_file_intercept;
for (i = 0; i < NTHREADS; i++) {
thd_args[i] = i;

View File

@@ -3,13 +3,13 @@
static bool did_prof_dump_open;
static int
prof_dump_open_intercept(bool propagate_err, const char *filename) {
prof_dump_open_file_intercept(const char *filename, int mode) {
int fd;
did_prof_dump_open = true;
fd = open("/dev/null", O_WRONLY);
expect_d_ne(fd, -1, "Unexpected open() failure");
assert_d_ne(fd, -1, "Unexpected open() failure");
return fd;
}
@@ -26,7 +26,7 @@ TEST_BEGIN(test_gdump) {
sizeof(active)), 0,
"Unexpected mallctl failure while activating profiling");
prof_dump_open = prof_dump_open_intercept;
prof_dump_open_file = prof_dump_open_file_intercept;
did_prof_dump_open = false;
p = mallocx((1U << SC_LG_LARGE_MINCLASS), 0);

View File

@@ -5,7 +5,7 @@
static bool did_prof_dump_open;
static int
prof_dump_open_intercept(bool propagate_err, const char *filename) {
prof_dump_open_file_intercept(const char *filename, int mode) {
int fd;
did_prof_dump_open = true;
@@ -15,7 +15,7 @@ prof_dump_open_intercept(bool propagate_err, const char *filename) {
- 1), 0, "Dump file name should start with \"" TEST_PREFIX ".\"");
fd = open("/dev/null", O_WRONLY);
expect_d_ne(fd, -1, "Unexpected open() failure");
assert_d_ne(fd, -1, "Unexpected open() failure");
return fd;
}
@@ -38,7 +38,7 @@ TEST_BEGIN(test_idump) {
sizeof(active)), 0,
"Unexpected mallctl failure while activating profiling");
prof_dump_open = prof_dump_open_intercept;
prof_dump_open_file = prof_dump_open_file_intercept;
did_prof_dump_open = false;
p = mallocx(1, 0);

View File

@@ -1,11 +1,11 @@
#include "test/jemalloc_test.h"
static int
prof_dump_open_intercept(bool propagate_err, const char *filename) {
prof_dump_open_file_intercept(const char *filename, int mode) {
int fd;
fd = open("/dev/null", O_WRONLY);
expect_d_ne(fd, -1, "Unexpected open() failure");
assert_d_ne(fd, -1, "Unexpected open() failure");
return fd;
}
@@ -276,7 +276,7 @@ TEST_END
int
main(void) {
/* Intercept dumping prior to running any tests. */
prof_dump_open = prof_dump_open_intercept;
prof_dump_open_file = prof_dump_open_file_intercept;
return test_no_reentrancy(
test_prof_reset_basic,