From 3d2856db31456e9a117209eccf8e1167b4401205 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Sun, 24 Apr 2022 14:19:25 +0200 Subject: [PATCH] Update tests to use new filename generation code. --- .github/workflows/ci.yml | 11 ++++++++--- core/crypto/util/util.odin | 1 + tests/core/Makefile | 29 +++++++++++++++-------------- tests/core/build.bat | 32 +++++++++++++++++--------------- tests/issues/run.bat | 21 ++++++++------------- tests/issues/run.sh | 19 +++++++++---------- tests/vendor/Makefile | 3 ++- tests/vendor/build.bat | 3 ++- 8 files changed, 62 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cc4283b0..989f56712 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,9 @@ jobs: make timeout-minutes: 10 - name: Odin issues tests - run: tests/issues/run.sh + run: | + cd tests/issues + run.sh timeout-minutes: 10 - name: Odin check examples/all for Linux i386 run: ./odin check examples/all -vet -strict-style -target:linux_i386 @@ -91,7 +93,9 @@ jobs: make timeout-minutes: 10 - name: Odin issues tests - run: tests/issues/run.sh + run: | + cd tests/issues + run.sh timeout-minutes: 10 - name: Odin check examples/all for Darwin arm64 run: ./odin check examples/all -vet -strict-style -target:darwin_arm64 @@ -163,7 +167,8 @@ jobs: shell: cmd run: | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat - call tests\issues\run.bat + cd tests\issues + call build.bat timeout-minutes: 10 - name: Odin check examples/all for Windows 32bits shell: cmd diff --git a/core/crypto/util/util.odin b/core/crypto/util/util.odin index 6273a232e..83b07e546 100644 --- a/core/crypto/util/util.odin +++ b/core/crypto/util/util.odin @@ -11,6 +11,7 @@ package util */ import "core:mem" +_ :: mem // @note(bp): this can replace the other two cast_slice :: #force_inline proc "contextless" ($D: typeid/[]$DE, src: $S/[]$SE) -> D { diff --git a/tests/core/Makefile b/tests/core/Makefile index 6a92b4efb..9bb622633 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -1,5 +1,6 @@ ODIN=../../odin PYTHON=$(shell which python3) +OUT_FILE=test_binary.bin all: download_test_assets image_test compress_test strings_test hash_test crypto_test noise_test encoding_test \ math_test linalg_glsl_math_test filepath_test reflect_test os_exit_test @@ -8,39 +9,39 @@ download_test_assets: $(PYTHON) download_assets.py image_test: - $(ODIN) run image/test_core_image.odin -file + $(ODIN) run image/test_core_image.odin -out=$(OUT_FILE) -file compress_test: - $(ODIN) run compress/test_core_compress.odin -file + $(ODIN) run compress/test_core_compress.odin -out=$(OUT_FILE) -file strings_test: - $(ODIN) run strings/test_core_strings.odin -file + $(ODIN) run strings/test_core_strings.odin -out=$(OUT_FILE) -file hash_test: - $(ODIN) run hash -out=test_hash -o:speed -no-bounds-check + $(ODIN) run hash -out=$(OUT_FILE) -o:speed -no-bounds-check crypto_test: - $(ODIN) run crypto -out=test_crypto_hash -o:speed -no-bounds-check + $(ODIN) run crypto -out=$(OUT_FILE) -o:speed -no-bounds-check noise_test: - $(ODIN) run math/noise -out=test_noise + $(ODIN) run math/noise -out=$(OUT_FILE) encoding_test: - $(ODIN) run encoding/hxa -out=test_hxa -collection:tests=.. - $(ODIN) run encoding/json -out=test_json - $(ODIN) run encoding/varint -out=test_varint + $(ODIN) run encoding/hxa -out=$(OUT_FILE) -collection:tests=.. + $(ODIN) run encoding/json -out=$(OUT_FILE) + $(ODIN) run encoding/varint -out=$(OUT_FILE) math_test: - $(ODIN) run math/test_core_math.odin -out=test_core_math -file -collection:tests=.. + $(ODIN) run math/test_core_math.odin -out=$(OUT_FILE) -file -collection:tests=.. linalg_glsl_math_test: - $(ODIN) run math/linalg/glsl/test_linalg_glsl_math.odin -file -out=test_linalg_glsl_math -collection:tests=.. + $(ODIN) run math/linalg/glsl/test_linalg_glsl_math.odin -file -out=$(OUT_FILE) -collection:tests=.. filepath_test: - $(ODIN) run path/filepath/test_core_filepath.odin -file -out=test_core_filepath -collection:tests=.. + $(ODIN) run path/filepath/test_core_filepath.odin -file -out=$(OUT_FILE) -collection:tests=.. reflect_test: - $(ODIN) run reflect/test_core_reflect.odin -file -out=test_core_reflect -collection:tests=.. + $(ODIN) run reflect/test_core_reflect.odin -file -out=$(OUT_FILE) -collection:tests=.. os_exit_test: - $(ODIN) run os/test_core_os_exit.odin -file -out=test_core_os_exit && exit 1 || exit 0 + $(ODIN) run os/test_core_os_exit.odin -file -out=$(OUT_FILE) && exit 1 || exit 0 diff --git a/tests/core/build.bat b/tests/core/build.bat index 1973c22aa..331a473aa 100644 --- a/tests/core/build.bat +++ b/tests/core/build.bat @@ -1,65 +1,67 @@ @echo off -set COMMON=-show-timings -no-bounds-check -vet -strict-style -collection:tests=.. +set OUT_FILE=test_binary.exe +set COMMON=-show-timings -no-bounds-check -vet -strict-style -collection:tests=.. -out:%OUT_FILE% set PATH_TO_ODIN==..\..\odin + python3 download_assets.py echo --- echo Running core:image tests echo --- -%PATH_TO_ODIN% run image %COMMON% -out:test_image +%PATH_TO_ODIN% run image %COMMON% echo --- echo Running core:compress tests echo --- -%PATH_TO_ODIN% run compress %COMMON% -out:test_compress +%PATH_TO_ODIN% run compress %COMMON% echo --- echo Running core:strings tests echo --- -%PATH_TO_ODIN% run strings %COMMON% -out:test_strings +%PATH_TO_ODIN% run strings %COMMON% echo --- echo Running core:hash tests echo --- -%PATH_TO_ODIN% run hash %COMMON% -o:size -out:test_hash +%PATH_TO_ODIN% run hash %COMMON% -o:size echo --- echo Running core:odin tests echo --- -%PATH_TO_ODIN% run odin %COMMON% -o:size -out:test_odin +%PATH_TO_ODIN% run odin %COMMON% -o:size echo --- echo Running core:crypto hash tests echo --- -%PATH_TO_ODIN% run crypto %COMMON% -out:test_crypto +%PATH_TO_ODIN% run crypto %COMMON% echo --- echo Running core:encoding tests echo --- -%PATH_TO_ODIN% run encoding/hxa %COMMON% -out:test_hxa -%PATH_TO_ODIN% run encoding/json %COMMON% -out:test_json -%PATH_TO_ODIN% run encoding/varint %COMMON% -out:test_varint +%PATH_TO_ODIN% run encoding/hxa %COMMON% +%PATH_TO_ODIN% run encoding/json %COMMON% +%PATH_TO_ODIN% run encoding/varint %COMMON% echo --- echo Running core:math/noise tests echo --- -%PATH_TO_ODIN% run math/noise %COMMON% -out:test_noise +%PATH_TO_ODIN% run math/noise %COMMON% echo --- echo Running core:math tests echo --- -%PATH_TO_ODIN% run math %COMMON% -out:test_math +%PATH_TO_ODIN% run math %COMMON% echo --- echo Running core:math/linalg/glsl tests echo --- -%PATH_TO_ODIN% run math/linalg/glsl %COMMON% -out:test_glsl +%PATH_TO_ODIN% run math/linalg/glsl %COMMON% echo --- echo Running core:path/filepath tests echo --- -%PATH_TO_ODIN% run path/filepath %COMMON% -out:test_filepath +%PATH_TO_ODIN% run path/filepath %COMMON% echo --- echo Running core:reflect tests echo --- -%PATH_TO_ODIN% run reflect %COMMON% -out:test_reflect +%PATH_TO_ODIN% run reflect %COMMON% diff --git a/tests/issues/run.bat b/tests/issues/run.bat index a652d9694..a936bd896 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -1,17 +1,12 @@ @echo off +set PATH_TO_ODIN==..\..\odin +set COMMON=-collection:tests=.. -out:build\test_issue +if not exist "build" mkdir build -if not exist "tests\issues\build\" mkdir tests\issues\build +%PATH_TO_ODIN% build test_issue_829.odin %COMMON% -file +build\test_issue -set COMMON=-collection:tests=tests -out:tests\issues\build\test_issue +%PATH_TO_ODIN% build test_issue_1592.odin %COMMON% -file +build\test_issue -@echo on - -.\odin build tests\issues\test_issue_829.odin %COMMON% -file -tests\issues\build\test_issue - -.\odin build tests\issues\test_issue_1592.odin %COMMON% -file -tests\issues\build\test_issue - -@echo off - -rmdir /S /Q tests\issues\build +rmdir /S /Q build diff --git a/tests/issues/run.sh b/tests/issues/run.sh index 117a9a5f1..ec6d7130d 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -1,18 +1,17 @@ #!/bin/bash +ODIN=../../odin +COMMON="-collection:tests=.. -out:build/test_issue.bin" + set -eu - -mkdir -p tests/issues/build - -COMMON="-collection:tests=tests -out:tests/issues/build/test_issue" - +mkdir -p build set -x -./odin build tests/issues/test_issue_829.odin $COMMON -file -tests/issues/build/test_issue +$ODIN build test_issue_829.odin $COMMON -file +build/test_issue.bin -./odin build tests/issues/test_issue_1592.odin $COMMON -file -tests/issues/build/test_issue +$ODIN build test_issue_1592.odin $COMMON -file +build/test_issue.bin set +x -rm -rf tests/issues/build +rm -rf build diff --git a/tests/vendor/Makefile b/tests/vendor/Makefile index c508f6c50..380e64e09 100644 --- a/tests/vendor/Makefile +++ b/tests/vendor/Makefile @@ -1,5 +1,6 @@ ODIN=../../odin ODINFLAGS= +OUT_FILE=test_binary.bin OS=$(shell uname) @@ -10,4 +11,4 @@ endif all: botan_test botan_test: - $(ODIN) run botan -out=test_botan_hash -o:speed -no-bounds-check $(ODINFLAGS) + $(ODIN) run botan -out=$(OUT_FILE) -o:speed -no-bounds-check $(ODINFLAGS) diff --git a/tests/vendor/build.bat b/tests/vendor/build.bat index e70d9f1d5..4bd9a6496 100644 --- a/tests/vendor/build.bat +++ b/tests/vendor/build.bat @@ -1,5 +1,6 @@ @echo off -set COMMON=-show-timings -no-bounds-check -vet -strict-style +set OUT_FILE=test_binary.exe +set COMMON=-show-timings -no-bounds-check -vet -strict-style -out:%OUT_FILE% set PATH_TO_ODIN==..\..\odin echo ---