From 7024fa81ec8d40e34c4bc24f6040352676a87d03 Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Sun, 1 Dec 2019 02:59:46 +0000 Subject: [PATCH] Fix benchmark programs by correcting program paths --- test/Makefile | 2 +- test/{dev_null => data_sink}/Makefile | 0 test/{dev_null => data_sink}/main.c | 1 + test/pipe_throughput/main.c | 2 +- test/spawn_and_exit_latency/main.c | 2 +- test/unix_socket_throughput/main.c | 4 ++-- 6 files changed, 6 insertions(+), 5 deletions(-) rename test/{dev_null => data_sink}/Makefile (100%) rename test/{dev_null => data_sink}/main.c (94%) diff --git a/test/Makefile b/test/Makefile index ac5f925f..0d7c5b7a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,7 +3,7 @@ PROJECT_DIR := $(realpath $(CUR_DIR)/../) BUILD_DIR := $(PROJECT_DIR)/build # Dependencies: need to be compiled but not to run by any Makefile target -TEST_DEPS := dev_null client +TEST_DEPS := client data_sink # Tests: need to be compiled and run by test-% target TESTS := empty env hello_world malloc mmap file fs_perms getpid spawn sched pipe time \ truncate readdir mkdir link tls pthread uname rlimit server \ diff --git a/test/dev_null/Makefile b/test/data_sink/Makefile similarity index 100% rename from test/dev_null/Makefile rename to test/data_sink/Makefile diff --git a/test/dev_null/main.c b/test/data_sink/main.c similarity index 94% rename from test/dev_null/main.c rename to test/data_sink/main.c index e94b73ce..0152c01c 100644 --- a/test/dev_null/main.c +++ b/test/data_sink/main.c @@ -5,6 +5,7 @@ #define MIN(x, y) ((x) <= (y) ? (x) : (y)) +// This program consumes a specific amount of data from stdin int main(int argc, const char* argv[]) { // Get the total number of bytes to read size_t remain_bytes = 0; diff --git a/test/pipe_throughput/main.c b/test/pipe_throughput/main.c index 4ca17372..11e2f339 100644 --- a/test/pipe_throughput/main.c +++ b/test/pipe_throughput/main.c @@ -33,7 +33,7 @@ int main(int argc, const char* argv[]) { posix_spawn_file_actions_addclose(&file_actions, pipe_wr_fd); int child_pid; - if (posix_spawn(&child_pid, "dev_null", &file_actions, + if (posix_spawn(&child_pid, "/bin/data_sink", &file_actions, NULL, NULL, NULL) < 0) { printf("ERROR: failed to spawn a child process\n"); return -1; diff --git a/test/spawn_and_exit_latency/main.c b/test/spawn_and_exit_latency/main.c index 90f93715..36a5244c 100644 --- a/test/spawn_and_exit_latency/main.c +++ b/test/spawn_and_exit_latency/main.c @@ -13,7 +13,7 @@ int main(int argc, const char* argv[]) { gettimeofday(&tv_start, NULL); for (unsigned long i = 0; i < NREPEATS; i++) { int child_pid, status; - if (posix_spawn(&child_pid, "empty", NULL, NULL, NULL, NULL) <0) { + if (posix_spawn(&child_pid, "/bin/empty", NULL, NULL, NULL, NULL) <0) { printf("ERROR: failed to spawn (# of repeats = %lu)\n", i); return -1; } diff --git a/test/unix_socket_throughput/main.c b/test/unix_socket_throughput/main.c index 8312c87f..3bdaf3bc 100644 --- a/test/unix_socket_throughput/main.c +++ b/test/unix_socket_throughput/main.c @@ -110,8 +110,8 @@ int main(int argc, const char* argv[]) { int child_pid; extern char ** environ; - char* new_argv[] = {"./dev_null", NULL}; - if (posix_spawn(&child_pid, "dev_null", &file_actions, + char* new_argv[] = {"/bin/data_sink", NULL}; + if (posix_spawn(&child_pid, "/bin/data_sink", &file_actions, NULL, new_argv, environ) < 0) { printf("ERROR: failed to spawn a child process\n"); return -1;