Skip to content

Commit

Permalink
Merge pull request #6 from saturn691/main
Browse files Browse the repository at this point in the history
Add documentation on test.py script, set as default testing script
  • Loading branch information
Fiwo735 authored Feb 6, 2024
2 parents d629d2f + 8365409 commit 28fa32d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
id: test
timeout-minutes: 1
run: |
./test.sh
./scripts/test.sh
- name: Perm issue fix
if: success() || failure()
Expand Down
25 changes: 23 additions & 2 deletions docs/c_compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,31 @@ If you wish to use C++, then a basic framework for building your compiler has be

Source files can be found in the [./src](../src) folder and header files can be found in the [./include](../include) folder.

You can test your compiler against the provided test-suite by running [`./test.sh`](../test.sh) from the top of this repo; the output should look as follows:
If you have Python installed, you can test your compiler by running
[`scripts/test.py`](../scripts/test.py) from the top of this repo; the
output should look as follows (note: the progress bar will be coloured).
Full usage guide is found in the file header.

```console
> ./test.sh
> scripts/test.py
>
make: Entering directory '/home/saturn691/projects/university/iac/langproc-cw'
make: 'bin/c_compiler' is up to date.
make: Leaving directory '/home/saturn691/projects/university/iac/langproc-cw'
Running Tests [################################################################]
Pass: 1 | Fail: 87 | Remaining: 0
See logs for more details (use -v for verbose output).

>> Test Summary: 1 Passed, 87 Failed

```

If Python is not installed, you can also test your compiler against the provided
test-suite by running [`scripts/test.sh`](../scripts/test.sh) from the top of
this repo; the output should look as follows:

```console
> scripts/test.sh
>
compiler_tests/_example/example.c
> Pass
Expand Down
2 changes: 1 addition & 1 deletion docs/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ For example:
user@host:/workspaces/langproc-cw# cd coverage
user@host:/workspaces/langproc-cw/coverage# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
```
```
2 changes: 1 addition & 1 deletion scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


__version__ = "0.1.0"
__author__ = "William Huynh"
__author__ = "William Huynh (@saturn691)"


import argparse
Expand Down
10 changes: 9 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#!/bin/bash

. scripts/test.sh
# If Python does not work, run scripts/ to test

if ! command -v python3 &> /dev/null; then
echo "Python is not installed. Installing Python..."
sudo apt-get update
sudo apt-get install python3 -y
fi

. scripts/test.py

0 comments on commit 28fa32d

Please sign in to comment.