diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-08-23 17:41:23 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-08-23 17:41:23 +0900 |
| commit | 8646e6f693fd935c6cb81e776a6c92a3fd093a33 (patch) | |
| tree | 450b60115282243bf0567b495e9e85f0d56abba1 /tests | |
| parent | d83647f390d2910547ada2854eee6189e8552cb8 (diff) | |
| download | ducc-8646e6f693fd935c6cb81e776a6c92a3fd093a33.tar.gz ducc-8646e6f693fd935c6cb81e776a6c92a3fd093a33.tar.zst ducc-8646e6f693fd935c6cb81e776a6c92a3fd093a33.zip | |
feat: output executable using gcc
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/098.sh | 16 | ||||
| -rw-r--r-- | tests/test_helpers.sh | 19 |
2 files changed, 19 insertions, 16 deletions
diff --git a/tests/098.sh b/tests/098.sh new file mode 100644 index 0000000..33c4f17 --- /dev/null +++ b/tests/098.sh @@ -0,0 +1,16 @@ +cat > foo.c <<'EOF' +int main() {} +EOF + +"$ducc" -o bar.s foo.c +if [[ $? -ne 0 ]]; then + exit 1 +fi +gcc -o a.out bar.s +./a.out "$@" +exit_code=$? + +if [[ $exit_code -ne 0 ]]; then + echo "invalid exit code: $exit_code" >&2 + exit 1 +fi diff --git a/tests/test_helpers.sh b/tests/test_helpers.sh index 9169c24..349dc3a 100644 --- a/tests/test_helpers.sh +++ b/tests/test_helpers.sh @@ -2,12 +2,7 @@ function test_exit_code() { set +e cat > main.c - "$ducc" main.c > main.s - if [[ $? -ne 0 ]]; then - set -e - exit 1 - fi - gcc -o a.out main.s + "$ducc" -o a.out main.c ./a.out exit_code=$? @@ -24,11 +19,7 @@ function test_exit_code() { function test_diff() { cat > main.c - "$ducc" main.c > main.s - if [[ $? -ne 0 ]]; then - exit 1 - fi - gcc -o a.out main.s + "$ducc" -o a.out main.c if [[ ! -f input ]]; then touch input fi @@ -61,11 +52,7 @@ function test_compile_error() { function test_example() { filename="../../../examples/$1.c" - "$ducc" "$filename" > main.s - if [[ $? -ne 0 ]]; then - exit 1 - fi - gcc -o a.out main.s + "$ducc" -o a.out "$filename" if [[ ! -f input ]]; then touch input fi |
