Skip to content

Commit

Permalink
Improve test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
wtetsu committed Apr 29, 2023
1 parent 182ed9e commit faf50af
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 37 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ build-linux:
ut:
go test github.com/wtetsu/gaze/pkg/...
e2e:
go build -ldflags "-s -w" -o test/e2e -v ${CMD}
go build -ldflags "-s -w" -o test/e2e/ -v ${CMD}
cd test/e2e && sh test_all.sh

cov:
go test -coverprofile=coverage.txt -covermode=atomic github.com/wtetsu/gaze/pkg/...
clean:
Expand Down
24 changes: 12 additions & 12 deletions test/e2e/test01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ filedir=$dir/files
cd $dir
rm -f test.*.log

timeout -sKILL 5 ${gaze} -v files/*.* | tee test.log &
timeout -sKILL 6 ${gaze} -v files/*.* | tee test.log &

sleep 1.0
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.go
sleep 0.2
sleep 0.3
echo >> $filedir/hello.py
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rs
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.go
sleep 0.2
sleep 0.3
echo >> $filedir/hello.py
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rs
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.py
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rs
sleep 0.2
sleep 0.3

wait

Expand Down
22 changes: 11 additions & 11 deletions test/e2e/test02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ filedir=$dir/files
cd $dir
rm -f test.*.log

timeout -sKILL 5 ${gaze} -v -c "ruby {{file}} 1" -r files/*.* | tee test.log &
timeout -sKILL 6 ${gaze} -v -c "ruby {{file}} 1" -r files/*.* | tee test.log &

sleep 1.0
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3
echo >> $filedir/hello.rb
sleep 0.2
sleep 0.3

wait

Expand Down
24 changes: 12 additions & 12 deletions test/e2e/test03.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ cp $filedir/hello.py "$filedir/he&llo.py"
cp $filedir/hello.py "$filedir/he llo.py"
cp $filedir/hello.py "$filedir/he(llo.py"

timeout -sKILL 5 ${gaze} -v files/*.* | tee test.log &
timeout -sKILL 6 ${gaze} -v files/*.* | tee test.log &

sleep 1.0
echo >> "$filedir/he'llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he&llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he(llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he'llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he&llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he'llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he(llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he&llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he llo.py"
sleep 0.2
sleep 0.3
echo >> "$filedir/he(llo.py"

wait
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/test_all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#! /bin/sh

# dry-run
sh test01.sh ./main

sh test01.sh ./main
r01=$?

Expand All @@ -13,3 +16,7 @@ r03=$?
echo "test01.sh: $r01"
echo "test02.sh: $r02"
echo "test03.sh: $r03"

if [ $r01 -ne 0 ] || [ $r02 -ne 0 ] || [ $r03 -ne 0 ]; then
exit 1
fi

0 comments on commit faf50af

Please sign in to comment.