From 8ca30edbfaeb2fadc9aa43f2290fe24d101bbe94 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Mon, 3 Feb 2020 16:03:51 -0800 Subject: [PATCH] [Make] Remove the use of wildcards The use of wildcards in Makefiles for targets is undesirable for tests. For example, if a file is deleted accidentally, Make doesn't detect it. What needs to be build should be explicit. This patch replaces the use of wildcards in tests' Makefiles with explicitly listed executables. --- LibOS/shim/test/benchmark/Makefile | 20 ++++-- LibOS/shim/test/fs/Makefile | 26 ++++++-- LibOS/shim/test/inline/Makefile | 18 ++++-- LibOS/shim/test/native/Makefile | 73 ++++++++++++++++++++-- LibOS/shim/test/regression/Makefile | 94 +++++++++++++++++++++++++++-- Pal/regression/Makefile | 18 +++++- Pal/test/Makefile | 29 +++++++-- 7 files changed, 251 insertions(+), 27 deletions(-) diff --git a/LibOS/shim/test/benchmark/Makefile b/LibOS/shim/test/benchmark/Makefile index 76efbb56..5e76d0f9 100644 --- a/LibOS/shim/test/benchmark/Makefile +++ b/LibOS/shim/test/benchmark/Makefile @@ -1,8 +1,20 @@ -c_executables = $(patsubst %.c,%,$(wildcard *.c)) -cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp)) +c_executables = \ + fork_latency \ + rpc_latency \ + rpc_latency2 \ + sig_latency \ + start \ + test_start -exec_target = $(c_executables) $(cxx_executables) -target = $(exec_target) manifest +cxx_executables = + +exec_target = \ + $(c_executables) \ + $(cxx_executables) + +target = \ + $(exec_target) \ + manifest include ../../../../Scripts/Makefile.configs include ../../../../Scripts/Makefile.manifest diff --git a/LibOS/shim/test/fs/Makefile b/LibOS/shim/test/fs/Makefile index 9c88f174..16a18d1b 100644 --- a/LibOS/shim/test/fs/Makefile +++ b/LibOS/shim/test/fs/Makefile @@ -1,9 +1,27 @@ -execs = $(filter-out common common_copy,$(patsubst %.c,%,$(wildcard *.c))) -copy_execs = $(filter copy_%,$(execs)) -manifests = $(patsubst %.manifest.template,%.manifest,$(wildcard *.manifest.template)) manifest +copy_execs = \ + copy_mmap_rev \ + copy_mmap_seq \ + copy_mmap_whole \ + copy_rev \ + copy_seq \ + copy_whole + +execs = \ + $(copy_execs) \ + delete \ + open_close \ + read_write \ + seek_tell \ + stat \ + truncate + +manifests = manifest exec_target = $(execs) -target = $(exec_target) $(manifests) + +target = \ + $(exec_target) \ + $(manifests) clean-extra += clean-tmp diff --git a/LibOS/shim/test/inline/Makefile b/LibOS/shim/test/inline/Makefile index 42897444..5e220587 100644 --- a/LibOS/shim/test/inline/Makefile +++ b/LibOS/shim/test/inline/Makefile @@ -1,8 +1,18 @@ -c_executables = $(patsubst %.c,%,$(wildcard *.c)) -cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp)) +c_executables = \ + fork \ + helloworld \ + vfork -exec_target = $(c_executables) $(cxx_executables) -target = $(c_executables) $(cxx_executables) manifest +cxx_executables = + +exec_target = \ + $(c_executables) \ + $(cxx_executables) + +target = \ + $(c_executables) \ + $(cxx_executables) \ + manifest include ../../../../Scripts/Makefile.configs include ../../../../Scripts/Makefile.manifest diff --git a/LibOS/shim/test/native/Makefile b/LibOS/shim/test/native/Makefile index e3b475ee..105d0d29 100644 --- a/LibOS/shim/test/native/Makefile +++ b/LibOS/shim/test/native/Makefile @@ -1,9 +1,72 @@ -c_executables = $(patsubst %.c,%,$(wildcard *.c)) -cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp)) -manifests = $(patsubst %.template,%,$(wildcard *.manifest.template)) manifest +c_executables = \ + alarm \ + brk \ + clone \ + condvar \ + cpuinfo \ + dir \ + divzero \ + dup \ + epoll \ + epoll_socket \ + errno \ + exec_fork \ + file \ + fork \ + fork_bomb \ + fork_exec \ + fs \ + futextest \ + get_time \ + helloworld \ + helloworld_pthread \ + kill \ + malloc \ + meminfo \ + msg_create \ + msg_create_libos \ + msg_send \ + msg_send_libos \ + multiproc \ + multisleep \ + pause \ + pid_alloc \ + pid_kill \ + pipe \ + pipe_latency \ + readdir \ + rename \ + script \ + sem \ + sleep \ + socketpair \ + sqrt \ + start \ + sync \ + system \ + tcp \ + test_start_pthread_m \ + time \ + vfork \ + vfork_exec -exec_target = $(c_executables) $(cxx_executables) ls.manifest -target = $(exec_target) $(manifests) +cxx_executables = + +manifests = \ + manifest \ + exec_fork.manifest \ + ls.manifest \ + script.manifest \ + static.manifest + +exec_target = \ + $(c_executables) \ + $(cxx_executables) \ + ls.manifest + +target = \ + $(exec_target) \ + $(manifests) include ../../../../Scripts/Makefile.configs include ../../../../Scripts/Makefile.manifest diff --git a/LibOS/shim/test/regression/Makefile b/LibOS/shim/test/regression/Makefile index e9f4a8c2..d595487e 100644 --- a/LibOS/shim/test/regression/Makefile +++ b/LibOS/shim/test/regression/Makefile @@ -1,9 +1,93 @@ -c_executables = $(patsubst %.c,%,$(wildcard *.c)) -cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp)) -manifests = $(patsubst %.manifest.template,%.manifest,$(wildcard *.manifest.template)) manifest +c_executables = \ + abort \ + abort_multithread \ + bootstrap \ + bootstrap_pie \ + bootstrap_static \ + cpuid \ + epoll_wait_timeout \ + eventfd \ + exec \ + exec_invalid_args \ + exec_same \ + exec_victim \ + exit \ + exit_group \ + fdleak \ + file_check_policy \ + file_size \ + fopen_cornercases \ + fork_and_exec \ + fstat_cwd \ + futex_bitset \ + futex_requeue \ + futex_timeout \ + futex_wake_op \ + getcwd \ + getdents \ + getsockopt \ + host_root_fs \ + init_fail \ + large-mmap \ + large_dir_read \ + mmap-file \ + mprotect_file_fork \ + multi_pthread \ + openmp \ + poll \ + poll_many_types \ + ppoll \ + proc \ + proc-path \ + proc_cpuinfo \ + pselect \ + readdir \ + sched \ + select \ + shared_object \ + sigaltstack \ + sigprocmask \ + spinlock \ + stat_invalid_args \ + str_close_leak \ + syscall \ + tcp_ipv6_v6only \ + tcp_msg_peek \ + udp \ + unix \ + vfork_and_exec -exec_target = $(c_executables) $(cxx_executables) file_check_policy_strict.manifest file_check_policy_allow_all_but_log.manifest -target = $(exec_target) $(manifests) +cxx_executables = bootstrap-c++ + +manifests = \ + manifest \ + eventfd.manifest \ + exec_victim.manifest \ + exit_group.manifest \ + file_check_policy_allow_all_but_log.manifest \ + file_check_policy_strict.manifest \ + futex_bitset.manifest \ + futex_requeue.manifest \ + futex_wake_op.manifest \ + getdents.manifest \ + host_root_fs.manifest \ + init_fail.manifest \ + large-mmap.manifest \ + mmap-file.manifest \ + multi_pthread.manifest \ + openmp.manifest \ + proc-path.manifest \ + shared_object.manifest + +exec_target = \ + $(c_executables) \ + $(cxx_executables) \ + file_check_policy_strict.manifest \ + file_check_policy_allow_all_but_log.manifest + +target = \ + $(exec_target) \ + $(manifests) clean-extra += clean-tmp diff --git a/Pal/regression/Makefile b/Pal/regression/Makefile index 4f01a6c6..2cff4b6d 100644 --- a/Pal/regression/Makefile +++ b/Pal/regression/Makefile @@ -37,7 +37,23 @@ executables = \ Thread2 \ normalize_path -manifests = manifest $(patsubst %.manifest.template,%.manifest,$(wildcard *.manifest.template)) +manifests = \ + manifest \ + Attestation.manifest \ + AvxDisable.manifest \ + Bootstrap2.manifest \ + Bootstrap3.manifest \ + Bootstrap4.manifest \ + Bootstrap5.manifest \ + Bootstrap6.manifest \ + Bootstrap7.manifest \ + File.manifest \ + Process.manifest \ + Process2.manifest \ + Process3.manifest \ + SendHandle.manifest \ + Thread2.manifest \ + nonelf_binary.manifest target = $(executables) $(manifests) diff --git a/Pal/test/Makefile b/Pal/test/Makefile index 5a6a2601..269cbc0c 100644 --- a/Pal/test/Makefile +++ b/Pal/test/Makefile @@ -4,12 +4,33 @@ include ../../Scripts/Makefile.rules CFLAGS += -fno-builtin -nostdlib -no-pie \ -I../include/pal -I../include/lib -executables = HelloWorld File Failure Thread Fork Event Process Exception \ - Memory Pipe Tcp Udp Yield Server Wait HandleSend Select Segment \ - Sleep Pie +executables = \ + HelloWorld \ + File \ + Failure \ + Thread \ + Fork \ + Event \ + Process \ + Exception \ + Memory \ + Pipe \ + Tcp \ + Udp \ + Yield \ + Server \ + Wait \ + HandleSend \ + Select \ + Segment \ + Sleep \ + Pie + manifests = manifest -target = $(executables) $(manifests) +target = \ + $(executables) \ + $(manifests) include ../../Scripts/Makefile.manifest