-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathCMakeLists.txt
98 lines (80 loc) · 3.09 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cmake_minimum_required(VERSION 2.8)
project(safeexec)
include_directories(${CMAKE_SOURCE_DIR})
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(PLATFORM bsd)
set(LINKED_LIBS kvm)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(PLATFORM linux)
else ()
message(FATAL_ERROR "This OS is not supported.")
endif ()
add_executable(safeexec safeexec.c error.c safe.c setlimit.c platform/${PLATFORM}/setlimits.c platform/${PLATFORM}/memusage.c)
target_link_libraries(safeexec ${LINKED_LIBS})
add_custom_target(permission chown root safeexec
COMMAND chmod u+s safeexec)
add_executable(tests/test-stderr tests/test-stderr.c)
add_executable(tests/test-write tests/test-write.c )
add_executable(tests/test-read tests/test-read.c )
add_executable(tests/test-fork tests/test-fork.c )
add_executable(tests/test-io tests/test-io.c )
add_executable(tests/test-mle tests/test-mle.c )
add_executable(tests/test-ole tests/test-ole.c )
add_executable(tests/test-ret tests/test-ret.c )
add_executable(tests/test-tle tests/test-tle.c )
add_executable(tests/test-wtle tests/test-wtle.c )
enable_testing()
add_test(memory-limit-exceeded tests/driver.rb test-mle
"--mem 32768"
"Memory Limit Exceeded"
"elapsed time: ? seconds"
"memory usage: >32768 kbytes"
"cpu usage: ? seconds")
add_test(time-limit-exceeded tests/driver.rb test-tle
"--cpu 1"
"Time Limit Exceeded"
"elapsed time: >1 seconds"
"memory usage: ? kbytes"
"cpu usage: >1 seconds")
add_test(output-limit-exceeded tests/driver.rb test-ole
" "
"Time Limit Exceeded"
"elapsed time: >1 seconds"
"memory usage: ? kbytes"
"cpu usage: >1 seconds")
add_test(fork-attemp tests/driver.rb test-fork
"--nproc 0"
"Command exited with non-zero status"
"elapsed time: ? seconds"
"memory usage: ? kbytes"
"cpu usage: ? seconds")
add_test(file-write-prepare chmod 0644 tests/file.dat)
add_test(file-write-attemp tests/driver.rb test-write
" "
"Command exited with non-zero status"
"elapsed time: ? seconds"
"memory usage: ? kbytes"
"cpu usage: ? seconds")
add_test(file-read-prepare chmod 0620 tests/secret.txt)
add_test(file-read-attemp tests/driver.rb test-read
" "
"Command exited with non-zero status"
"elapsed time: ? seconds"
"memory usage: ? kbytes"
"cpu usage: ? seconds")
add_test(return-code tests/driver.rb test-ret
" "
"Command exited with non-zero status"
"elapsed time: ? seconds"
"memory usage: ? kbytes"
"cpu usage: ? seconds")
add_test(wall-time-limit-exceeded tests/driver.rb test-wtle
"--clock 3"
"Time Limit Exceeded"
"elapsed time: >3 seconds"
"memory usage: ? kbytes"
"cpu usage: ? seconds")
install(TARGETS safeexec
DESTINATION "bin"
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(SCRIPT chown.cmake)