From 82c55d405de436083a55e584f7043a8bb24f60de Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Sat, 28 Aug 2021 16:20:34 -0500 Subject: [PATCH] Merge master into branch to fix web server tests (#1185) * suppress warning for detached head during civitweb clone closes #1180 * disable sigchld handler by default #931 (#1182) * disable sigchld handler by default #931 * update test to set sigchld trap before testing closes #931 * Fixed webserver http_alloc test (#1184) Co-authored-by: cherpin00 <44306236+cherpin00@users.noreply.github.com> --- Makefile | 2 +- share/trick/pymods/trick/tests/civet_server/test_http.py | 3 +-- .../Executive/Executive_init_signal_handlers.cpp | 4 ++-- trick_source/sim_services/Executive/test/Executive_test.cpp | 5 +++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5682053f..509c8706 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ ${CIVET_CLONE_DIR}/libcivetweb.a: ${CIVET_CLONE_DIR} $(MAKE) -C ${CIVET_CLONE_DIR} lib COPT=${CIVET_COMPILE_FAGS} WITH_CPP=1 WITH_WEBSOCKET=1 ${CIVET_CLONE_DIR}: - git clone --branch v1.14 --depth 1 https://github.com/civetweb/civetweb.git $@ + git clone --branch v1.14 --depth 1 -c advice.detachedHead=false https://github.com/civetweb/civetweb.git $@ #------------------------------------------------------------------------------- # 1.3 Build Trick's Java Tools diff --git a/share/trick/pymods/trick/tests/civet_server/test_http.py b/share/trick/pymods/trick/tests/civet_server/test_http.py index af5cb9db..f5edd433 100644 --- a/share/trick/pymods/trick/tests/civet_server/test_http.py +++ b/share/trick/pymods/trick/tests/civet_server/test_http.py @@ -55,7 +55,7 @@ class TestWebserverHttp: assert len(data["alloc_list"]) == 10, "Expecting default &count to be 10." assert data["chunk_size"] == 10, "Expecting default &count to be 10." assert data["chunk_start"] == 0, "expecting default &start to be 0." - assert data["alloc_total"] == 48, "Expecting 48 memory allocations." + assert "alloc_total" in res.json(), "Expecting alloc_total field to exist." def test_alloc_info_2(self): start = 2 @@ -65,7 +65,6 @@ class TestWebserverHttp: res = requests.get(url, verify=False) assert len(res.json()["alloc_list"]) == count assert res.json()["chunk_start"] == start - assert res.json()["alloc_total"] == 48, "Expecting 48 memory allocations." def test_vs_connections(self): sockets = open_connections(1) diff --git a/trick_source/sim_services/Executive/Executive_init_signal_handlers.cpp b/trick_source/sim_services/Executive/Executive_init_signal_handlers.cpp index 8302d1f3..a7ae1298 100644 --- a/trick_source/sim_services/Executive/Executive_init_signal_handlers.cpp +++ b/trick_source/sim_services/Executive/Executive_init_signal_handlers.cpp @@ -175,12 +175,12 @@ int Trick::Executive::init_signal_handlers() { static struct sigaction sigact; - /* By default catch SIGBUS, SIGSEGV, SIGABRT, and SIGCHLD. Don't catch SIGFPE */ + /* By default catch SIGBUS, SIGSEGV, SIGABRT. Don't catch SIGFPE, SIGCHLD */ set_trap_sigbus(true) ; set_trap_sigfpe(false) ; set_trap_sigsegv(true) ; set_trap_sigabrt(true) ; - set_trap_sigchld(true) ; + set_trap_sigchld(false) ; /* Assign ctrl_c_hand() as the default signal handler for SIGINT ( keypress). */ sigact.sa_handler = (void (*)(int)) ctrl_c_hand; diff --git a/trick_source/sim_services/Executive/test/Executive_test.cpp b/trick_source/sim_services/Executive/test/Executive_test.cpp index 78e0726b..a4a2e775 100644 --- a/trick_source/sim_services/Executive/test/Executive_test.cpp +++ b/trick_source/sim_services/Executive/test/Executive_test.cpp @@ -796,18 +796,19 @@ TEST_F(ExecutiveTest , SetSignalHandlers) { EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; sigaction(SIGSEGV, NULL , &sigact) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; - sigaction(SIGCHLD, NULL , &sigact) ; - EXPECT_TRUE( sigact.sa_handler == child_handler ) ; sigaction(SIGFPE, NULL , &sigact) ; EXPECT_TRUE( sigact.sa_handler == SIG_DFL ) ; exec.set_trap_sigbus(1) ; exec.set_trap_sigsegv(1) ; exec.set_trap_sigfpe(1) ; + exec.set_trap_sigchld(1) ; sigaction(SIGBUS, NULL , &sigact) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; sigaction(SIGSEGV, NULL , &sigact) ; EXPECT_TRUE( sigact.sa_handler == sig_hand ) ; + sigaction(SIGCHLD, NULL , &sigact) ; + EXPECT_TRUE( sigact.sa_handler == child_handler ) ; sigaction(SIGFPE, NULL , &sigact) ; #if __APPLE__ EXPECT_TRUE( sigact.sa_handler == fpe_sig_handler ) ;