Skip to content

Commit

Permalink
ci: Test the JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
jfsmig committed Oct 15, 2018
1 parent f518027 commit 732258a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 12 deletions.
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ language: c
install:
- sudo apt-get install -y --force-yes gcc make cmake libglib2.0-dev
- sudo apt-get install -y --force-yes autoconf automake libtool xutils-dev
- sudo apt-get install -y --force-yes jq
env:
matrix:
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
script:
before_script:
- set -e
- mkdir /tmp/oio
- export CMAKE_OPTS='-DCMAKE_INSTALL_PREFIX=/tmp/oio -DLD_LIBDIR=lib'
- export CMAKE_OPTS='-DCMAKE_INSTALL_PREFIX=/tmp/ROOT'
- cmake ${CMAKE_OPTS} -DCMAKE_BUILD_TYPE=$BUILD_TYPE .
- make all
- make install
script:
- set -e
- export PATH="$PATH:/tmp/ROOT/bin" TMPDIR=/tmp
- ./tools/gridinit-genconf.sh 15
- gridinit -d -s gridinit /tmp/gridinit/gridinit.conf
- ./tools/cycle.sh
- pkill gridinit
17 changes: 17 additions & 0 deletions tools/cycle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e
set -x

CMD="gridinit_cmd -S /tmp/gridinit/gridinit.sock"

$CMD -f json status | jq

for G in @test-0 @test-1 '' '@test-0 @test-1' ; do
$CMD status $G
$CMD stop $G
$CMD start $G
$CMD status $G
done

$CMD -f json status | jq

32 changes: 22 additions & 10 deletions tools/gridinit-genconf.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
#!/usr/bin/env bash
set -e
MAX=$1
shift
set -x

MAX=$1 ; shift
[[ -n "$MAX" ]]

cat > /tmp/gridinit.conf <<EOF
[[ -d "$TMPDIR" ]]
BASEDIR="${TMPDIR}/gridinit"
mkdir -p "$BASEDIR"

cat > "$BASEDIR/gridinit.conf" <<EOF
[Default]
listen=/tmp/gridinit.sock
pidfile=/tmp/gridinit.pid
working_dir=/tmp
listen=$BASEDIR/gridinit.sock
pidfile=$BASEDIR/gridinit.pid
working_dir=$BASEDIR
inherit_env=1
limit.core_size=0
limit.max_files=256
limit.stack_size=32
include=$BASEDIR/{*,*/*}.conf
EOF

for i in $(seq ${MAX}) ; do
cat >> /tmp/gridinit.conf <<EOF
for i in 0 1 2 ; do
if ! [[ -e "$BASEDIR/$i" ]] ; then
mkdir "$BASEDIR/$i"
fi
done

for i in $(seq ${MAX}) ; do
sub=$((i%3))
cat >> $BASEDIR/$sub/service-${i}.conf <<EOF
[service.TEST-$i]
group=test
group=test-$((i%2))
on_die=respawn
enabled=true
start_at_boot=true
command=/bin/sleep $((i+15))
command=/bin/sleep $((i+30))
EOF
done

0 comments on commit 732258a

Please sign in to comment.