Skip to content

Commit

Permalink
[CI-Examples,tests] Remove/shorten sleep invocations
Browse files Browse the repository at this point in the history
Replace sleeps with more appropriate wait-for tools, or at least shorten
the sleep interval.

Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
  • Loading branch information
dimakuv committed Sep 22, 2023
1 parent ac8fc77 commit 2ad54dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions CI-Examples/common_tools/benchmark-http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ do
echo "wrk -c $CONNECTIONS -d $DURATION -t $CONCURRENCY -R $REQUESTS $DOWNLOAD_HOST/$DOWNLOAD_FILE"
wrk -c "$CONNECTIONS" -d "$DURATION" -t "$CONCURRENCY" -R "$REQUESTS" "$DOWNLOAD_HOST/$DOWNLOAD_FILE" > OUTPUT || exit $?

sleep 5

THROUGHPUT_STR=$(grep -m1 "Req/Sec" OUTPUT | awk '{ print $2 }')
THROUGHPUT=$(throughput_in_bytes "$THROUGHPUT_STR")
if [ "$THROUGHPUT" = "0" ]; then
Expand Down
8 changes: 4 additions & 4 deletions CI-Examples/ra-tls-mbedtls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sgx_sign_client_epid: client_epid.manifest client
.PHONY: check_epid
check_epid: app epid
gramine-sgx server & SERVER_ID=$$!; \
sleep 30; \
../../scripts/wait_for_server 60 127.0.0.1 4433; \
./client epid > OUTPUT; \
./client epid 0 0 0 0 >> OUTPUT; \
kill -9 $$SERVER_ID
Expand All @@ -125,14 +125,14 @@ check_epid: app epid
.PHONY: check_epid_fail
check_epid_fail: app epid
gramine-sgx server --test-malicious-quote >/dev/null & SERVER_ID=$$!; \
sleep 30; \
../../scripts/wait_for_server 60 127.0.0.1 4433; \
./client epid && exit 1 || echo "[ Success 1/1 ]"; \
kill -9 $$SERVER_ID

.PHONY: check_dcap
check_dcap: app dcap
gramine-sgx server >/dev/null & SERVER_ID=$$!; \
sleep 30; \
../../scripts/wait_for_server 60 127.0.0.1 4433; \
./client dcap > OUTPUT; \
./client dcap 0 0 0 0 >> OUTPUT; \
kill -9 $$SERVER_ID
Expand All @@ -145,7 +145,7 @@ check_dcap: app dcap
.PHONY: check_dcap_fail
check_dcap_fail: app dcap
gramine-sgx server --test-malicious-quote >/dev/null & SERVER_ID=$$!; \
sleep 30; \
../../scripts/wait_for_server 60 127.0.0.1 4433; \
./client dcap && exit 1 || echo "[ Success 1/1 ]"; \
kill -9 $$SERVER_ID

Expand Down
2 changes: 1 addition & 1 deletion CI-Examples/ra-tls-nginx/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
gramine-sgx nginx &
pid=$!

sleep 10
../../scripts/wait_for_server 60 localhost 8000

test "$(curl --insecure -s https://localhost:8000/)" = "$(cat html/index.html)"
ret=$?
Expand Down
3 changes: 1 addition & 2 deletions libos/test/regression/eventfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ static void* write_eventfd_thread(void* arg) {
}

for (int i = 0; i < MAX_EFDS; i++) {
sleep(1);
if (write(efds[i], &count, sizeof(count)) != sizeof(count)) {
perror("write error");
return NULL;
Expand Down Expand Up @@ -91,7 +90,7 @@ static int eventfd_using_poll(void) {
}

while (1) {
poll_ret = poll(pollfds, MAX_EFDS, 5000);
poll_ret = poll(pollfds, MAX_EFDS, 1000);

if (poll_ret == 0) {
printf("Poll timed out. Exiting.\n");
Expand Down

0 comments on commit 2ad54dd

Please sign in to comment.