Skip to content

Commit

Permalink
[soil/app-tests] Run all ble.sh tests with bash
Browse files Browse the repository at this point in the history
It completes in about 13 seconds

We can do it with osh-py, but it's too slow for CI.  TODO: Add osh-cpp

Create a new image with 'contra' deps
  • Loading branch information
Andy C committed May 18, 2023
1 parent f85ade4 commit 0bab512
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
2 changes: 2 additions & 0 deletions deps/from-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ app-tests() {

# for ble.sh contra
libx11-dev
libxft-dev
libncursesw5-dev
)

apt-install "${packages[@]}"
Expand Down
2 changes: 1 addition & 1 deletion deps/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set -o pipefail
set -o errexit

# Build with this tag
readonly LATEST_TAG='v-2023-05-18b'
readonly LATEST_TAG='v-2023-05-18c'

# BUGS in Docker.
#
Expand Down
2 changes: 1 addition & 1 deletion soil/host-shim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ live-image-tag() {
case $image_id in
(app-tests)
# new ble.sh deps
echo 'v-2023-05-18b'
echo 'v-2023-05-18c'
;;
(wild)
# Rebuild with smaller common layer, without GCC
Expand Down
13 changes: 7 additions & 6 deletions soil/worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,13 @@ EOF
# Reuse ovm-tarball container
app-tests-tasks() {
cat <<EOF
os-info soil/diagnose.sh os-info -
dump-env soil/diagnose.sh dump-env -
py-all build/py.sh all -
ble-clone test/ble.sh clone -
ble-build test/ble.sh build -
ble-test test/ble.sh run-tests -
os-info soil/diagnose.sh os-info -
dump-env soil/diagnose.sh dump-env -
py-all build/py.sh all -
ble-clone test/ble.sh clone -
ble-build test/ble.sh build -
ble-test-bash test/ble.sh run-tests-bash -
ble-test-osh-py test/ble.sh run-tests-osh-py -
EOF

# Only for tarball build
Expand Down
38 changes: 36 additions & 2 deletions test/ble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ clone() {
mkdir -p $out
git clone --recursive --depth=50 --branch=osh \
https://github.com/akinomyoga/ble.sh $out
git clone --depth=50 \
https://github.com/akinomyoga/contra.git $out/ext/contra.src
}

# TODO: What version of osh
Expand All @@ -28,24 +30,56 @@ build() {
# make ble.sh
cd $BASE_DIR
make

# make contra for test
cd ext/contra.src
make
cp src/contra ..
}

# https://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream
filter-ansi() {
sed 's/\x1b\[[0-9;]*m//g'
}

run-tests() {
run-tests-osh-py() {
cd $BASE_DIR

#wc -l oshrc.test-util
#wc -l out/ble.osh
#wc -l lib/test-util.sh

# Force interactive shell on Travis, but remove color.
# Shorter tests
../../bin/osh -i --rcfile oshrc.test-util | filter-ansi

# Longer tests
# TODO: Run these with osh-cpp
# ../../bin/osh out/ble.osh --test | filter-ansi

echo DONE
}

# Seems to take about 12 seconds
run-tests-bash() {
cd $BASE_DIR

set +o errexit
bash out/ble.sh --test | filter-ansi

# Some failures, possibly due to old version of bash

# 98.1% [section] ble/util: 1205/1228 (23 fail, 0 crash, 6 skip)
# 100.0% [section] ble/canvas/trace (relative:confine:measure-bbox): 17/17 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/canvas/trace (cfuncs): 18/18 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/canvas/trace (justify): 30/30 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/canvas/trace-text: 11/11 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/textmap#update: 5/5 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/unicode/GraphemeCluster/c2break: 77/77 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/unicode/GraphemeCluster/c2break (GraphemeBreakTest.txt): 3251/3251 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/decode: 33/33 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/edit: 2/2 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/syntax: 22/22 (0 fail, 0 crash, 0 skip)
# 100.0% [section] ble/complete: 7/7 (0 fail, 0 crash, 0 skip)
}

"$@"

0 comments on commit 0bab512

Please sign in to comment.