Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/lind_compile
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ if [[ "${PRINT_ARGS}" == "true" && ( "${MODE}" == "full" || "${MODE}" == "compil
debug_default_clang_flags=(
-pthread
-g
-O0
-O2
)
if [[ "${COMPILE_GRATE}" == "true" ]]; then
debug_default_clang_flags+=(-Wl,--export=pass_fptr_to_wt)
Expand Down Expand Up @@ -329,7 +329,7 @@ if [[ "${PRINT_ARGS}" == "true" && ( "${MODE}" == "full" || "${MODE}" == "compil
debug_default_clang_flags=(
-pthread
-g
-O0
-O2
)
if [[ "${COMPILE_GRATE}" == "true" ]]; then
debug_default_clang_flags+=(-Wl,--export=pass_fptr_to_wt)
Expand Down Expand Up @@ -358,7 +358,7 @@ do_static_compile() {
local -a default_clang_flags=(
-pthread
-g
-O0
-O2
)

if [[ "${COMPILE_GRATE}" == "true" ]]; then
Expand Down Expand Up @@ -392,7 +392,7 @@ do_dynamic_compile() {
local -a default_clang_flags=(
-pthread
-g
-O0
-O2
-fPIC
)

Expand Down Expand Up @@ -429,7 +429,7 @@ do_library_compile() {
)
local -a default_clang_flags=(
-g
-O0
-O2
-fPIC
)

Expand Down
1 change: 1 addition & 0 deletions skip_test_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dylink_tests/deterministic/dlopen_fork.c
dylink_tests/deterministic/dlopen_thread.c
dylink_tests/deterministic/double_fork_dlopen.c
dylink_tests/deterministic/fork_dlopen.c
file_tests/deterministic/statfs.c
ci/deterministic/ci_intentional_failure_tmp.c
2 changes: 1 addition & 1 deletion tests/unit-tests/file_tests/deterministic/filetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main()
char buffer[WRITE_BUFFER_SIZE] = "";
char readbuffer[WRITE_BUFFER_SIZE];
for (int i = 0; i < WRITE_BUFFER_SIZE - 1; i++) buffer[i] = 'A';
buffer[WRITE_BUFFER_SIZE] = 0;
buffer[WRITE_BUFFER_SIZE - 1] = 0;

int test_fd = open(FILENAME, O_RDWR);
write(test_fd, buffer, WRITE_BUFFER_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests/file_tests/deterministic/filetest1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main()
char buffer[WRITE_BUFFER_SIZE] = "";
char readbuffer[WRITE_BUFFER_SIZE];
for (int i = 0; i < WRITE_BUFFER_SIZE - 1; i++) buffer[i] = 'A';
buffer[WRITE_BUFFER_SIZE] = 0;
buffer[WRITE_BUFFER_SIZE - 1] = 0;

for (int j = 0; j < 1000; j++) {

Expand Down
17 changes: 7 additions & 10 deletions tests/unit-tests/memory_tests/deterministic/fork_large_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ static void wait_child(pid_t pid)
pid_t w = waitpid(pid, &status, 0);
assert(w >= 0);
assert(WIFEXITED(status));
if (WEXITSTATUS(status) != 0) {
printf("FAIL: child exited with status %d\n", WEXITSTATUS(status));
}
assert(WEXITSTATUS(status) == 0);
}

Expand Down Expand Up @@ -73,7 +70,7 @@ int main(void)
}
wait_child(pid);
for (int i = 0; i < NCHUNKS; i++) free(chunks[i]);
printf("Test 1 PASS: large heap survives fork\n");
/* Test 1 PASS */

/* ---- Test 2: mmap region ---- */
#define MMAP_SIZE (4 * 1024 * 1024)
Expand All @@ -95,7 +92,7 @@ int main(void)
}
wait_child(pid);
munmap(mapped, MMAP_SIZE);
printf("Test 2 PASS: mmap region survives fork\n");
/* Test 2 PASS */

/* ---- Test 3: Nested fork with heap growth ---- */
char *pre = (char *)malloc(4 * 1024 * 1024);
Expand Down Expand Up @@ -124,7 +121,7 @@ int main(void)
}
wait_child(pid);
free(pre);
printf("Test 3 PASS: nested fork with heap growth\n");
/* Test 3 PASS */

/* ---- Test 4: Guard page pattern (mmap PROT_NONE + partial mprotect) ---- */
#define GUARD_TOTAL (16 * 4096) /* 64 KB total */
Expand Down Expand Up @@ -155,7 +152,7 @@ int main(void)
}
wait_child(pid);
munmap(guarded, GUARD_TOTAL);
printf("Test 4 PASS: guard page + mprotect survives fork\n");
/* Test 4 PASS */

/* ---- Test 5: Many fragmented mmaps ---- */
#define FRAG_COUNT 64
Expand All @@ -182,7 +179,7 @@ int main(void)
}
wait_child(pid);
for (int i = 0; i < FRAG_COUNT; i++) munmap(frags[i], FRAG_SIZE);
printf("Test 5 PASS: fragmented mmaps survive fork\n");
/* Test 5 PASS */

/* ---- Test 6: Network sockets before fork (lmbench pattern) ---- */
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
Expand Down Expand Up @@ -222,7 +219,7 @@ int main(void)
wait_child(pid);
close(sockfd);
free(netbuf);
printf("Test 6 PASS: socket + large buffer survives fork\n");
/* Test 6 PASS */

/* ---- Test 7: mmap + munmap holes ---- */
#define HOLE_SIZE (8 * 4096) /* 32 KB */
Expand Down Expand Up @@ -255,7 +252,7 @@ int main(void)
wait_child(pid);
munmap(a, HOLE_SIZE);
munmap(c, HOLE_SIZE);
printf("Test 7 PASS: mmap/munmap holes survive fork\n");
/* Test 7 PASS */

printf("All tests passed.\n");
return 0;
Expand Down
21 changes: 11 additions & 10 deletions tests/unit-tests/process_tests/deterministic/wait.c
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <assert.h>

int main(void) {
pid_t pid = fork();
assert(pid >= 0);

if (pid == 0) {
// Child
sleep(1);
return 0;
} else {
// Parent
wait(NULL);
printf("Parent detected child finished.\n");
int ret = wait(NULL);
assert(ret >= 0);
}

pid = fork();
assert(pid >= 0);

if (pid == 0) {
// Child
sleep(1);
return 0;
} else {
// Parent
int status = -1;
while(wait(&status) == -1);
printf("Child exited with status %d\n", status);
while (wait(&status) == -1)
;
assert(WIFEXITED(status));
assert(WEXITSTATUS(status) == 0);
}

printf("wait: all tests passed\n");
return 0;
}
2 changes: 1 addition & 1 deletion tests/unit-tests/signal_tests/deterministic/alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdlib.h>
#include <unistd.h>

int signal_counter = 3;
volatile int signal_counter = 3;

void alarm_handler(int sig) {
signal_counter -= 1;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests/signal_tests/deterministic/setitimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <sys/time.h>
#include <unistd.h>

int signal_counter = 3;
volatile int signal_counter = 3;

void alarm_handler(int sig) {
signal_counter -= 1;
Expand Down