Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
emper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Schmaus
emper
Commits
a03cafb9
Commit
a03cafb9
authored
4 years ago
by
Florian Schmaus
Browse files
Options
Downloads
Patches
Plain Diff
Add tools/test-echo-server-and-client script
parent
ac18a709
No related branches found
No related tags found
No related merge requests found
Pipeline
#61095
passed
4 years ago
Stage: smoke-test
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+4
-0
4 additions, 0 deletions
Makefile
tools/test-echo-server-and-client
+101
-0
101 additions, 0 deletions
tools/test-echo-server-and-client
with
105 additions
and
0 deletions
Makefile
+
4
−
0
View file @
a03cafb9
...
@@ -102,6 +102,10 @@ fix-includes: all
...
@@ -102,6 +102,10 @@ fix-includes: all
stresstest
:
test
stresstest
:
test
./stresstest/stresstest.sh build/tests/simplest_fib_test
./stresstest/stresstest.sh build/tests/simplest_fib_test
PHONY
:
test-echo
test-echo
:
./tools/test-echo-server-and-client
# TODO: Determine how we can run also jobs from the 'test' stage,
# TODO: Determine how we can run also jobs from the 'test' stage,
# e.g. test-gcc.
# e.g. test-gcc.
.PHONY
:
gitlab-runner
.PHONY
:
gitlab-runner
...
...
This diff is collapsed.
Click to expand it.
tools/test-echo-server-and-client
0 → 100755
+
101
−
0
View file @
a03cafb9
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright © 2021 Florian Schmaus
set
-euo
pipefail
SCRIPTDIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&> /dev/null
&&
pwd
)
"
ROOTDIR
=
"
$(
readlink
-f
"
${
SCRIPTDIR
}
/.."
)
"
BUILDDIR
=
"
${
ROOTDIR
}
/build"
echoerr
()
{
echo
"
$@
"
1>&2
;
}
PRESERVE_TMPDIR
=
false
while
getopts
:dp OPT
;
do
case
$OPT
in
d
)
PRESERVE_TMPDIR
=
true
set
-x
;;
p
)
PRESERVE_TMPDIR
=
true
;;
*
)
print
"usage:
${
0
##*/
}
[-d] [--] ARGS..."
exit
2
esac
done
shift
$((
OPTIND
-
1
))
OPTIND
=
1
if
[[
!
-L
"
${
BUILDDIR
}
"
]]
;
then
make
-C
"
${
ROOTDIR
}
"
fi
TMPDIR
=
$(
mktemp
--directory
--tmpdir
=
/var/tmp emper-echo-test.XXXX
)
cleanup
()
{
if
!
$PRESERVE_TMPDIR
;
then
rm
-rf
"
${
TMPDIR
}
"
fi
# Ensure that we don't leave a stray echoserver
if
pgrep
--count
echoserver
>
/dev/null
;
then
killall echoserver
fi
}
trap
cleanup EXIT
echo
"Starting echo client/server test. Using
${
TMPDIR
}
for logs"
readonly
ECHO_CLIENT
=
"
${
BUILDDIR
}
/apps/echoclient"
readonly
ECHO_SERVER
=
"
${
BUILDDIR
}
/apps/echoserver"
run_echo_client_and_server
()
{
local
-r
run_name
=
"
${
1
}
"
local
-r
echo_client_opts
=
"
${
2
-
}
"
local
-r
logdir
=
"
${
TMPDIR
}
/
${
run_name
}
"
mkdir
"
${
logdir
}
"
local
-r
echo_server_pidfile
=
"
${
logdir
}
/echo_server.pid"
echo
"Performing echo client/server
${
run_name
}
run. Logdir:
${
logdir
}
"
"
${
ECHO_SERVER
}
"
\
>
"
${
logdir
}
/server.log"
\
2>
"
${
logdir
}
/server.err"
&
echo
"
${
!
}
"
>>
"
${
echo_server_pidfile
}
"
# Wait till the echo server port becomes accessible.
# https://stackoverflow.com/a/50055449/194894
timeout
30 bash
-c
\
'until printf "" 2>>/dev/null >>/dev/tcp/${0}/${1}; do sleep 1; done'
\
localhost 12345
set
+e
# shellcheck disable=SC2086
"
${
ECHO_CLIENT
}
"
\
${
echo_client_opts
}
\
>
"
${
logdir
}
/client.log"
\
2>
"
${
logdir
}
/client.err"
local
echo_client_ret
=
"
${
?
}
"
set
-e
local
echo_server_pid
echo_server_pid
=
$(
cat
"
${
echo_server_pidfile
}
"
)
if
ps
-p
"
${
echo_server_pid
}
"
>
/dev/null
;
then
# TODO: Re-enable this warning once the client is sending a
# 'quit' once it is finished.
# echoerr "WARNING: echo server was not terminated by client"
kill
"
${
echo_server_pid
}
"
fi
if
[[
"
${
echo_client_ret
}
"
-ne
0
]]
;
then
echoerr
"ERROR: Echo client exited with
${
echo_client_ret
}
"
PRESERVE_TMPDIR
=
true
exit
1
fi
}
run_echo_client_and_server
"quicktest"
"-c 10 -i 10"
run_echo_client_and_server
"load-switch"
"-c 100 -i 1000 --max-low-load-clients 50 --load-switch-period-ms 250"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment