Skip to content

Commit

Permalink
build: Update test.sh install logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bushidocodes committed Dec 4, 2021
1 parent 01bca00 commit 1f25f3d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
uses: actions/cache@v2
with:
path: ./runtime/bin/gocr_wasm.so
key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/gocr/**', './runtime/compiletime/**') }}
key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/Makefile', './runtime/tests/gocr/**', './runtime/compiletime/**', './runtime/compiletime/memory/**') }}
if: success() || failure()
- name: Hyde
run: |
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
uses: actions/cache@v2
with:
path: ./runtime/bin/ekf_wasm.so
key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/TinyEKF/**', './runtime/compiletime/**') }}
key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/Makefile', './runtime/tests/TinyEKF/**', './runtime/compiletime/**', './runtime/compiletime/memory/**') }}
if: success() || failure()
- name: EKF one iteration
run: |
Expand Down
21 changes: 21 additions & 0 deletions runtime/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,24 @@ resize.wasm:

../../runtime/bin/%.so: %.so
cp $^ $@

.PHONY: fibonacci.install
fibonacci.install: ../../runtime/bin/fibonacci_wasm.so

.PHONY: empty.install
empty.install: ../../runtime/bin/empty_wasm.so

.PHONY: ekf.install
ekf.install: ../../runtime/bin/ekf_wasm.so

.PHONY: cifar10.install
cifar10.install: ../../runtime/bin/cifar10_wasm.so

.PHONY: gocr.install
gocr.install: ../../runtime/bin/gocr_wasm.so

.PHONY: lpd.install
lpd.install: ../../runtime/bin/lpd_wasm.so

.PHONY: resize.install
resize.install: ../../runtime/bin/resize_wasm.so
75 changes: 14 additions & 61 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,38 @@ declare -ra tests=(
lpd_by_plate_count
bimodal
concurrency
payload
)

declare -a failed_tests=()

# OCR Tests
# FIXME: OCR tests seem to sporadically fail and then work on rerun.
ocr_hyde() {
# FIXME: This check is a hack because GitHub Actions is caching
# the *.so file in the destination file, not the subodule it built from
if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then
make gocr -C "$base_dir/runtime/tests" || exit 1
fi
make gocr.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ocr/hyde" || exit 1
./run.sh || failed_tests+=("ocr_hyde")
popd || exit 1
return 0
}

ocr_handwriting() {
if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then
make gocr -C "$base_dir/runtime/tests" || exit 1
fi
make gocr.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ocr/handwriting" || exit 1
./run.sh || failed_tests+=("ocr_handwriting")
popd || exit 1
return 0
}

ocr_fivebyeight() {
if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then
make gocr -C "$base_dir/runtime/tests" || exit 1
fi
make gocr.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ocr/fivebyeight" || exit 1
./run.sh || failed_tests+=("ocr_fivebyeight")
popd || exit 1
return 0
}

ocr_by_word() {
if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then
make gocr -C "$base_dir/runtime/tests" || exit 1
fi
make gocr.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ocr/by_word" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("ocr_by_word")
Expand All @@ -75,9 +64,7 @@ ocr_by_word() {
}

ocr_by_font() {
if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then
make gocr -C "$base_dir/runtime/tests" || exit 1
fi
make gocr.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ocr/by_font" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("ocr_by_font")
Expand All @@ -86,9 +73,7 @@ ocr_by_font() {
}

ocr_by_dpi() {
if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then
make gocr -C "$base_dir/runtime/tests" || exit 1
fi
make gocr.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ocr/by_dpi" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("ocr_by_dpi")
Expand All @@ -98,19 +83,15 @@ ocr_by_dpi() {

# EKF Tests
ekf_by_iteration() {
if [[ ! -f "$base_dir/runtime/bin/ekf_wasm.so" ]]; then
make tinyekf -C "$base_dir/runtime/tests" || exit 1
fi
make ekf.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ekf/by_iteration" || exit 1
./run.sh || failed_tests+=("ekf_by_iteration")
popd || exit 1
return 0
}

ekf_one_iteration() {
if [[ ! -f "$base_dir/runtime/bin/ekf_wasm.so" ]]; then
make tinyekf -C "$base_dir/runtime/tests" || exit 1
fi
make ekf.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/ekf/one_iteration" || exit 1
./run.sh || failed_tests+=("ekf_one_iteration")
popd || exit 1
Expand All @@ -119,19 +100,15 @@ ekf_one_iteration() {

# cifar10 Tests
image_classification() {
if [[ ! -f "$base_dir/runtime/bin/cifar10_wasm.so" ]]; then
make cifar10 -C "$base_dir/runtime/tests" || exit 1
fi
make cifar10.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/imageclassification" || exit 1
./run.sh || failed_tests+=("image_classification")
popd || exit 1
return 0
}

image_resize() {
if [[ ! -f "$base_dir/runtime/bin/resize_wasm.so" ]]; then
make sod -C "$base_dir/runtime/tests" || exit 1
fi
make resize.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/imageresize/test" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("image_resize")
Expand All @@ -140,9 +117,7 @@ image_resize() {
}

image_resize_by_resolution() {
if [[ ! -f "$base_dir/runtime/bin/resize_wasm.so" ]]; then
make sod -C "$base_dir/runtime/tests" || exit 1
fi
make resize.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("image_resize_resolution")
Expand All @@ -151,9 +126,7 @@ image_resize_by_resolution() {
}

lpd_by_plate_count() {
if [[ ! -f "$base_dir/runtime/bin/lpd_wasm.so" ]]; then
make sod -C "$base_dir/runtime/tests" || exit 1
fi
make lpd.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/applications/licenseplate/by_plate_count" || exit 1
./run.sh || failed_tests+=("lpd_by_plate_count")
popd || exit 1
Expand All @@ -162,9 +135,7 @@ lpd_by_plate_count() {

bimodal() {
echo "Bimodal"
if [[ ! -f "$base_dir/runtime/bin/fibonacci_wasm.so" ]]; then
make rttests -C "$base_dir/runtime/tests" || exit 1
fi
make fibonacci.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/bimodal/" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("bimodal")
Expand All @@ -174,32 +145,14 @@ bimodal() {

concurrency() {
echo "Concurrency"
if [[ ! -f "$base_dir/runtime/bin/empty_wasm.so" ]]; then
make rttests -C "$base_dir/runtime/tests" || exit 1
fi
make empty.install -C "$base_dir/runtime/tests" || exit 1
pushd "$base_dir/runtime/experiments/concurrency/" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("concurrency")
popd || exit 1
return 0
}

payload() {
echo "Payload"
if [[ ! -f "$base_dir/runtime/bin/work1k_wasm.so" ]] \
|| [[ ! -f "$base_dir/runtime/bin/work10k_wasm.so" ]] \
|| [[ ! -f "$base_dir/runtime/bin/work100k_wasm.so" ]] \
|| [[ ! -f "$base_dir/runtime/bin/work1m_wasm.so" ]]; then
make rttests -C "$base_dir/runtime/tests" || exit 1
fi
# TODO: Make Dependency "work1k_wasm.so" "work10k_wasm.so" "work100k_wasm.so" "work1m_wasm.so"
pushd "$base_dir/runtime/experiments/payload/" || exit 1
# ./install.sh || exit 1
./run.sh || failed_tests+=("payload")
popd || exit 1
return 0
}

main() {
cd "$base_dir/awsm" && cargo build --release || exit 1
make all -C "$base_dir/runtime" || exit 1
Expand Down

0 comments on commit 1f25f3d

Please sign in to comment.