Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
margo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
sds
margo
Commits
c44dc05b
Commit
c44dc05b
authored
Apr 27, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
automated test for client/server
parent
af604096
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
3 deletions
+78
-3
tests/Makefile.subdir
tests/Makefile.subdir
+7
-3
tests/basic.sh
tests/basic.sh
+31
-0
tests/test-util.sh
tests/test-util.sh
+40
-0
No files found.
tests/Makefile.subdir
View file @
c44dc05b
check_PROGRAMS
+=
\
examples/sleep
examples/sleep
\
examples/server
\
examples/client
TESTS
+=
\
tests/sleep.sh
tests/sleep.sh
\
tests/basic.sh
EXTRA_DIST
+=
\
tests/sleep.sh
tests/sleep.sh
\
tests/basic.sh
tests/basic.sh
0 → 100755
View file @
c44dc05b
#!/bin/bash -x
if
[
-z
$srcdir
]
;
then
echo
srcdir variable not set.
exit
1
fi
source
$srcdir
/tests/test-util.sh
# start 1 server with 2 second wait, 20s timeout
test_start_servers 1 2 20
sleep
1
#####################
# run client test, which will also shut down server when done
run_to 10 examples/client
$svr1
&> /dev/null
if
[
$?
-ne
0
]
;
then
wait
exit
1
fi
#####################
wait
echo
cleaning up
$TMPBASE
rm
-rf
$TMPBASE
exit
0
tests/test-util.sh
0 → 100644
View file @
c44dc05b
#
# General test script utilities
#
function
run_to
()
{
maxtime
=
${
1
}
s
shift
timeout
--signal
=
9
$maxtime
"
$@
"
}
function
test_start_servers
()
{
nservers
=
${
1
:-
4
}
startwait
=
${
2
:-
15
}
maxtime
=
${
3
:-
120
}
s
repfactor
=
${
4
:-
0
}
pid
=
$$
startport
=
3344
endport
=
`
expr
3344 +
$nservers
- 1
`
# start daemons
for
i
in
`
seq
$startport
$endport
`
do
timeout
--signal
=
9
${
maxtime
}
examples/server tcp://localhost:
$i
single &
if
[
$?
-ne
0
]
;
then
# TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the
# return codes of the actual client side tests to tell if
# everything started properly
exit
1
fi
done
# wait for servers to start
sleep
${
startwait
}
svr1
=
"tcp://localhost:
$startport
"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment