Skip to content

Commit

Permalink
run systests on master (#19)
Browse files Browse the repository at this point in the history
plus some workflow tweaks.
temporarily excludes ruby from systests.
  • Loading branch information
matslina authored Feb 8, 2025
1 parent d776fcb commit d2adb2b
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 24 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/ci.yaml → .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
name: awib ci

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
name: Setup
description: "Setup for testing"

runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -36,11 +25,25 @@ jobs:
java-version: '11'
distribution: 'adopt'

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt # Optional: Add tools you need
override: true

- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y build-essential tcl
- name: Build awib.b
shell: bash
run: make

- name: Run tests
run: make test
- name: Build bfint
shell: bash
run: |
cd util
make
43 changes: 43 additions & 0 deletions .github/workflows/systest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Sys Test

on:
push:
branches:
- master

jobs:
systest:
runs-on: ubuntu-latest

strategy:
matrix:
method: [bfint gcc tclsh]
max-parallel: 10

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup/
- name: Run system test with ${{ matrix.method }}
shell: bash
run: |
cd systest
bash run.sh -m ${{ matrix.method }}
systest-bash:
runs-on: ubuntu-latest

strategy:
matrix:
case: [empty comments endoffile basicops memoryhog factor]
max-parallel: 10

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: .github/actions/setup/
- name: Run system test with bash for case ${{ matrix.case }}
shell: bash
run: |
cd systest
bash run.sh -m bash -c ${{ matrix.case }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Unit Test

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/actions/setup

- name: Run tests
run: make test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ binary: awib.b
gcc awib_make_binary2.c -o awib -O2

awib.b: awib-skeleton.b 386_linux/backend.b lang_c/backend.b frontend/frontend.b lang_generic/backend.b lang_generic/go.b lang_generic/ruby.b lang_generic/tcl.b lang_java/backend.b
python util/bfpp.py --interpreter --format formats/awib-0.3 --width 79 awib-skeleton.b > awib.b
util/bfpp.py --interpreter --format formats/awib-0.3 --width 79 awib-skeleton.b > awib.b

test: awib.b
python3 test/main.py
Expand Down
2 changes: 1 addition & 1 deletion systest/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

ALL_TARGETS="lang_c 386_linux lang_ruby lang_go lang_tcl lang_java lang_rust"
ALL_TARGETS="lang_c 386_linux lang_go lang_tcl lang_java lang_rust"
ALL_TEST_CASES=$(ls -1Sr *.b | cut -f1 -d.|xargs)
AWIB_BUILD="../awib.b"
ALL_METHODS="bfint gcc tclsh bash"
Expand Down
6 changes: 4 additions & 2 deletions test/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import os
import sys
import unittest

if __name__ == "__main__":
loader = unittest.TestLoader()
Expand All @@ -11,7 +12,8 @@
else:
suite = loader.discover('.', pattern='*_test.py')

runner = unittest.TextTestRunner()
verbosity = 2 if os.getenv("CI") else 1
runner = unittest.TextTestRunner(verbosity=verbosity)
result = runner.run(suite)

if not result.wasSuccessful():
Expand Down
2 changes: 1 addition & 1 deletion test/ruby_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class RubyTest(backend.LangGenericTestCase):
BACKEND_INDEX = 6

def run_program(self, path, input):
p = subprocess.Popen(['/usr/bin/ruby',path],
p = subprocess.Popen(['ruby',path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
stdout, stderr = p.communicate(input)
Expand Down
2 changes: 1 addition & 1 deletion util/bfpp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""Simple brainfuck preprocessor.
Expand Down

0 comments on commit d2adb2b

Please sign in to comment.