Skip to content

Commit

Permalink
add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 24, 2024
1 parent 317317a commit fb099bd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/compiler_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ jobs:
- name: Build Rivet compiler
run: |
v -o rivetc cmd/
make build
- name: Run Rivet compiler tests
run: |
v test compiler
v tests/run_tests.vsh
make test
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Local files
rivetc
main.ri
bin/rivetc
tests/gen_out_files
tests/run_tests
x.py

main.ri
x.py
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (C) 2024-present The Rivet programming language. Use of this source code
# is governed by an MIT license that can be found in the LICENSE file.

build:
v -o bin/rivetc cmd

test: build
v test compiler
v tests/run_tests.vsh
Empty file added bin/.gitkeep
Empty file.
8 changes: 5 additions & 3 deletions tests/run_tests.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import term
// test.err.ri -> test.err.out
// test.ok.ri -> test.ok.out

if !os.exists('rivetc') {
panic('rivetc executable not found')
const rivetc = 'bin/rivetc'

if !os.exists(rivetc) {
panic('`${rivetc}` executable not found')
}

mut passed := 0
Expand All @@ -23,7 +25,7 @@ for i, file in files {
mut test_passed := true
is_err_out := file.ends_with('.err.ri')
out_content := if is_err_out { os.read_file(file#[..-3] + '.out')! } else { '' }
res := os.execute('./rivetc ${file}')
res := os.execute('${rivetc} ${file}')
res_out := res.output.trim_space()
out_is_diff := res.exit_code != 0 && res_out != out_content
if is_err_out {
Expand Down

0 comments on commit fb099bd

Please sign in to comment.