Skip to content

Commit

Permalink
Have travis use meson test
Browse files Browse the repository at this point in the history
 - script sets up test file system
 - add -y flag to auto-accept setup prompt
 - change travis script to use meson test
  • Loading branch information
MatthewMerrill committed Jun 7, 2019
1 parent e1b6376 commit f7c00d1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ macros:
- pip install meson
script:
- meson build $MESON_OPTS
- ninja -C build
- wget http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86/alpine-minirootfs-3.9.4-x86.tar.gz -O alpine.tar.gz
- ./tools/fakefsify.py alpine.tar.gz alpine
- grep nameserver /etc/resolv.conf | head -1 | ./build/ish -f ./alpine /bin/sed -n "w /etc/resolv.conf"
- bash tests/e2e/e2e.bash
- ninja -C build test

matrix:
include:
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ if not meson.is_cross_build()
endif

e2e_test = find_program('tests/e2e/e2e.bash')
test('e2e', e2e_test, timeout: 120)
test('e2e', e2e_test, args: ['-y'], timeout: 120)
37 changes: 35 additions & 2 deletions tests/e2e/e2e.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ cd "$(dirname "$0")"
cd ../../
mkdir -p e2e_out

FS=./alpine
FS=./e2e_out/testfs
VERBOSE=false
YES_MODE=false
TEST_PATTERN=""
SUMMARY_LOG=./e2e_out/summary.txt
ALPINE_IMAGE="http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86/alpine-minirootfs-3.9.4-x86.tar.gz"
rm -f "$SUMMARY_LOG"

while getopts "hvf:e:" OPTION; do
while getopts "hvyf:e:" OPTION; do
case $OPTION in
v)
VERBOSE=true
Expand All @@ -24,6 +26,9 @@ while getopts "hvf:e:" OPTION; do
e)
TEST_PATTERN="$OPTARG"
;;
y)
YES_MODE=true
;;
h)
echo "iSH E2E Testing"
echo "==============="
Expand All @@ -34,6 +39,7 @@ while getopts "hvf:e:" OPTION; do
echo " -f fs Use \"fs\" as the -f option for iSH. Default \"alpine\"."
echo " -e pat Use pattern \"pat\" to pattern match tests to run."
echo " Syntax is same as grep -E for local system."
echo " -y Accept creation of test file system if it does not exist"
echo ""
echo "Example: Run the \"hello\" test in the alpine2 fake file system."
echo "$ bash e2e.bash -f alpine2 -e ^hello$"
Expand All @@ -44,6 +50,33 @@ done

ISH="./build/ish -f $FS"

if [ ! -d "$FS" ]; then
if [ "$YES_MODE" = "true" ]; then
INSTALL="Yes";
else
echo "File System \"$FS\" does not exist. Automatically set up now?"
select yn in "Yes" "No"; do
INSTALL="$yn";
break;
done
fi
echo install? $INSTALL
case "$INSTALL" in
Yes)
echo
echo "### Setting up test file system..."
echo "###### Downloading Alpine"
wget "$ALPINE_IMAGE" -O e2e_out/alpine.tar.gz
echo "###### Unpacking Alpine"
./tools/fakefsify.py e2e_out/alpine.tar.gz "$FS"
echo "###### Configuring iSH and installing base libraries"
grep -E "^nameserver" /etc/resolv.conf | head -1 | $ISH /bin/sed -n "w /etc/resolv.conf"
$ISH /bin/sh -c "apk update && apk add build-base python2 python3"
;;
No) exit 1;;
esac
fi

NUM_TOTAL=0
NUM_FAILS=0

Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/fpu/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/sh
apk update > verbose.txt
apk add gcc libc-dev >> verbose.txt
gcc test_fpu.c -o ./test_fpu
./test_fpu
3 changes: 0 additions & 3 deletions tests/e2e/hello/test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/bin/sh
echo Hello, sh!

apk update > verbose.txt
apk add python2 python3 >> verbose.txt
python test_python2.py
python3 test_python3.py

apk add gcc libc-dev >> verbose.txt
gcc test_c.c -o ./hello_c
./hello_c

0 comments on commit f7c00d1

Please sign in to comment.