Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Smoke instead of shelltestrunner #1710

Merged
merged 17 commits into from Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 16 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -262,19 +262,29 @@ jobs:
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name : Shell tests (Linux)
id: shell-tests-linux
- name: Download Smoke binary
uses: jaxxstorm/action-install-gh-release@v1.9.0
with:
repo: SamirTalwar/smoke
tag: v2.3.1
cache: enable
extension-matching: disable
rename-to: smoke
chmod: 0755

- name : Smoke testing (Linux)
id: smoke-linux
if: runner.os == 'Linux'
run : |
cd main
make test-shell
make smoke

- name : Shell tests (macOS)
id: shell-tests-macos
- name : Smoke testing (macOS)
id: smoke-macos
if: runner.os == 'macOS'
run : |
cd main
make CC=$CC LIBTOOL=$LIBTOOL test-shell
make CC=$CC LIBTOOL=$LIBTOOL smoke

docs:
needs: build
Expand Down
15 changes: 8 additions & 7 deletions Makefile
Expand Up @@ -163,14 +163,14 @@ MAKE=make ${MAKEAUXFLAGS}

STACKFLAGS?=--jobs $(THREADS)
STACKTESTFLAGS?=--ta --hide-successes --ta --ansi-tricks=false
SHELLTESTFLAGS?=--color --diff -a --hide-successes
SMOKEFLAGS?=--color --diff=git

.PHONY: check
check: clean
@${MAKE} build
@${MAKE} install
@${MAKE} test
@${MAKE} test-shell
@${MAKE} smoke
@${MAKE} format
@${MAKE} pre-commit

Expand Down Expand Up @@ -221,12 +221,13 @@ test-skip-slow:
fast-test-skip-slow:
@stack test --fast ${STACKFLAGS} ${STACKTESTFLAGS} --ta '-p "! /slow tests/"'

SHELLTEST := $(shell command -v shelltest 2> /dev/null)
SMOKE := $(shell command -v smoke 2> /dev/null)

.PHONY : test-shell
test-shell : install
@$(if $(SHELLTEST),, stack install shelltestrunner)
shelltest ${SHELLTESTFLAGS} tests
.PHONY : smoke
smoke: install
@$(if $(SMOKE),, $(error "Smoke not found, please install from the sources"))
jonaprieto marked this conversation as resolved.
Show resolved Hide resolved
@find tests/ -type f -name '*.smoke.yaml' \
-exec sh -c "echo -n 'Running {}'; echo ; ${SMOKE} ${SMOKEFLAGS} {}" \;

# -- Release

Expand Down
51 changes: 51 additions & 0 deletions tests/CLI/Commands/compile.smoke.yaml
@@ -0,0 +1,51 @@
working-directory: ./../../../tests

tests:
- name: shows-file-argument-for-autocompletion
command:
- juvix
- compile
- --help
stdout:
contains:
JUVIX_FILE
exit-status: 0

- name: minic-compilation
command:
shell:
- bash
script: |
juvix compile positive/MiniC/HelloWorld/Input.juvix -o hello.wasm
[ -f hello.wasm ]

stdout: ""
exit-status: 0

- name: hello-world
command:
shell:
- bash
script: |
cd ./../examples/milestone/HelloWorld
juvix compile HelloWorld.juvix
[ -f HelloWorld ]
./HelloWorld
exit-status: 0
stdout: |
hello world!

- name: flag-internal-build-dir
command:
shell:
- bash
script: |
temp=$(mktemp -d)
cd ./../examples/milestone/HelloWorld
juvix compile HelloWorld.juvix --internal-build-dir "$temp"
find "$temp" | wc -l
rm -rf "$temp"
stdout:
matches: |
\s*([2-9]|[1-9][0-9]+)
exit-status: 0
16 changes: 0 additions & 16 deletions tests/CLI/Commands/compile.test

This file was deleted.

52 changes: 52 additions & 0 deletions tests/CLI/Commands/dev/internal.smoke.yaml
@@ -0,0 +1,52 @@
working-directory: ./../../../../tests

tests:
- name: requires-subcommand
command:
- juvix
- dev
- internal
stderr:
contains: |
Usage: juvix dev internal COMMAND
exit-status: 1

- name: internal-typecheck
command:
- juvix
- dev
- internal
- typecheck
args:
- positive/Internal/Simple.juvix
stdout:
contains: |
Well done! It type checks
exit-status: 0

- name: internal-typecheck-only-errors
command:
- juvix
- --only-errors
- dev
- internal
- typecheck
args:
- positive/Internal/Simple.juvix
stdout: ""
exit-status: 0

- name: internal-typecheck-no-colors
command:
- juvix
- --no-colors
- dev
- internal
- typecheck
args:
- negative/Internal/MultiWrongType.juvix
stdout: ""
stderr:
matches: |-
(.+)\/([^\/]+)\.juvix\:[0-9]*\:[0-9]*\-[0-9]*\: error
exit-status: 1
21 changes: 0 additions & 21 deletions tests/CLI/Commands/dev/internal.test

This file was deleted.

26 changes: 26 additions & 0 deletions tests/CLI/Commands/dev/parse.smoke.yaml
@@ -0,0 +1,26 @@
working-directory: ./../../../../tests

tests:
- name: can-parse
command:
- juvix
- dev
- parse
args:
- positive/Axiom.juvix
stdout:
contains: "Module"
exit-status: 0

- name: no-pretty-show
command:
- juvix
- dev
- parse
- --no-pretty-show
args:
- positive/Axiom.juvix
stdout:
matches: |
Module \{.*
exit-status: 0
10 changes: 0 additions & 10 deletions tests/CLI/Commands/dev/parse.test

This file was deleted.

13 changes: 13 additions & 0 deletions tests/CLI/Commands/dev/root.smoke.yaml
@@ -0,0 +1,13 @@
working-directory: ./../../../../tests

tests:
- name: show
command:
- juvix
- dev
- root
stdout:
matches: |
.*?/juvix/tests/
exit-status: 0

3 changes: 0 additions & 3 deletions tests/CLI/Commands/dev/root.test

This file was deleted.

36 changes: 36 additions & 0 deletions tests/CLI/Commands/dev/termination.smoke.yaml
@@ -0,0 +1,36 @@
working-directory: ./../../../../tests

tests:
- name: requires-subcommand
command:
- juvix
- dev
- termination
stderr:
contains: |
Usage: juvix dev termination COMMAND
exit-status: 1

- name: calls-autocompletion-requires-files-arg
command:
- juvix
- dev
- termination
- calls
- --help
stdout:
contains: |
JUVIX_FILE
exit-status: 0

- name: graph-cmd-autocompletion-requires-files-arg
command:
- juvix
- dev
- termination
- graph
- --help
stdout:
contains: |
JUVIX_FILE
exit-status: 0
12 changes: 0 additions & 12 deletions tests/CLI/Commands/dev/termination.test

This file was deleted.

63 changes: 63 additions & 0 deletions tests/CLI/Commands/html.smoke.yaml
@@ -0,0 +1,63 @@
working-directory: ./../../../examples/

tests:
- name: html-stdout
command:
shell:
- bash
script: |
cd milestone/ValidityPredicates
juvix html SimpleFungibleToken.juvix
cat html/SimpleFungibleToken.html
stdout:
contains:
<!DOCTYPE HTML>
exit-status: 0

- name: output-dir
command:
shell:
- bash
script: |
rm -rf html
juvix html milestone/ValidityPredicates/SimpleFungibleToken.juvix --output-dir=html
[ -d html/assets ]
[ -f html/SimpleFungibleToken.html ]
stdout:
equals: |
Writing SimpleFungibleToken.html
exit-status: 0

- name: recursive-generation
command:
shell:
- bash
script: |
rm -rf html
juvix html milestone/ValidityPredicates/SimpleFungibleToken.juvix --output-dir=html --recursive
[ -d html/assets ]
[ -f html/SimpleFungibleToken.html ]
(ls html | wc -l)
cd html
[ -f Stdlib.Data.Ord.html ]
[ -f Stdlib.Data.String.html ]
[ -f Stdlib.Data.Nat.html ]
[ -f Stdlib.System.IO.html ]
[ -f Stdlib.Function.html ]
[ -f Stdlib.Data.List.html ]
[ -f Stdlib.Data.String.Ord.html ]
[ -f Stdlib.Data.Product.html ]
[ -f Data.Int.Ops.html ]
[ -f Stdlib.Data.Maybe.html ]
[ -f Data.Int.html ]
[ -f Stdlib.Data.Bool.html ]
[ -f Stdlib.Prelude.html ]
[ -f Anoma.Base.html ]
[ -f SimpleFungibleToken.html ]
[ -f assets/highlight.js ]
[ -f assets/source-ayu-light.css ]
[ -f assets/source-nord.css ]
stdout:
contains: |
Writing SimpleFungibleToken.html
exit-status: 0
12 changes: 0 additions & 12 deletions tests/CLI/Commands/html.test

This file was deleted.