raz / containers / ci / smoke.sh

42 lines · 864 B · raw · history · last change 4c98ab55

1#!/bin/sh
2set -eu
3work=$(mktemp -d)
4trap 'rm -rf "$work"' EXIT HUP INT TERM
5cd "$work"
6raz --version | grep '^raz 0\.21\.0, '
7cat > Hello.raz <<'EOF'
8module Hello;
9import Out;
10proc main*;
11begin
12 Out.str("hello, world\n");
13end;
14end Hello.
15EOF
16raz -Werror Hello.raz
17test "$(./Hello)" = 'hello, world'
18cat > Libc.raz <<'EOF'
19module Libc;
20import C;
21proc main*;
22const message = "libc-ok\n";
23begin
24 if C.write(1, PTR(message), LEN(message)) # LEN(message) then
25 C.exit(1);
26 end;
27end;
28end Libc.
29EOF
30raz -Werror Libc.raz
31test "$(./Libc)" = libc-ok
32raz -Werror -o Pretty /opt/raz/tools/Pretty.raz
33./Pretty Hello.raz > formatted.raz
34test -s formatted.raz
35test "$(concha -c 'echo concha-ok')" = concha-ok
36cat > Robfile <<'EOF'
37check:
38 printf 'robbie-ok\n'
39EOF
40robbie -q check > robbie.log
41grep -qx robbie-ok robbie.log
42printf 'raz CI smoke tests passed\n'