mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Change test runner options to SCREAMING_SNAKE_CASE
This commit also changes the name of `test_select` to `ODIN_TEST_NAMES`, to better conform with the already-existing `-test-name:<name>` option.
This commit is contained in:
+11
-11
@@ -23,19 +23,19 @@ _ :: pkg_log
|
|||||||
_ :: strings
|
_ :: strings
|
||||||
|
|
||||||
// Specify how many threads to use when running tests.
|
// Specify how many threads to use when running tests.
|
||||||
TEST_THREADS : int : #config(test_threads, 0)
|
TEST_THREADS : int : #config(ODIN_TEST_THREADS, 0)
|
||||||
// Track the memory used by each test.
|
// Track the memory used by each test.
|
||||||
TRACKING_MEMORY : bool : #config(test_track_memory, false)
|
TRACKING_MEMORY : bool : #config(ODIN_TEST_TRACK_MEMORY, false)
|
||||||
// Specify how much memory each thread allocator starts with.
|
// Specify how much memory each thread allocator starts with.
|
||||||
PER_THREAD_MEMORY : int : #config(test_thread_memory, mem.ROLLBACK_STACK_DEFAULT_BLOCK_SIZE)
|
PER_THREAD_MEMORY : int : #config(ODIN_TEST_THREAD_MEMORY, mem.ROLLBACK_STACK_DEFAULT_BLOCK_SIZE)
|
||||||
// Select a specific set of tests to run by name.
|
// Select a specific set of tests to run by name.
|
||||||
TEST_SELECT : string : #config(test_select, "")
|
TEST_NAMES : string : #config(ODIN_TEST_NAMES, "")
|
||||||
// Show the fancy animated progress report.
|
// Show the fancy animated progress report.
|
||||||
FANCY_OUTPUT : bool : #config(test_fancy, true)
|
FANCY_OUTPUT : bool : #config(ODIN_TEST_FANCY, true)
|
||||||
// Copy failed tests to the clipboard when done.
|
// Copy failed tests to the clipboard when done.
|
||||||
USE_CLIPBOARD : bool : #config(test_clipboard, false)
|
USE_CLIPBOARD : bool : #config(ODIN_TEST_CLIPBOARD, false)
|
||||||
// How many test results to show at a time per package.
|
// How many test results to show at a time per package.
|
||||||
PROGRESS_WIDTH : int : #config(test_progress_width, 24)
|
PROGRESS_WIDTH : int : #config(ODIN_TEST_PROGRESS_WIDTH, 24)
|
||||||
|
|
||||||
|
|
||||||
end_t :: proc(t: ^T) {
|
end_t :: proc(t: ^T) {
|
||||||
@@ -122,12 +122,12 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
|
|||||||
|
|
||||||
alloc_error: mem.Allocator_Error
|
alloc_error: mem.Allocator_Error
|
||||||
|
|
||||||
when TEST_SELECT != "" {
|
when TEST_NAMES != "" {
|
||||||
select_internal_tests: [dynamic]Internal_Test
|
select_internal_tests: [dynamic]Internal_Test
|
||||||
defer delete(select_internal_tests)
|
defer delete(select_internal_tests)
|
||||||
|
|
||||||
{
|
{
|
||||||
index_list := TEST_SELECT
|
index_list := TEST_NAMES
|
||||||
for selector in strings.split_iterator(&index_list, ",") {
|
for selector in strings.split_iterator(&index_list, ",") {
|
||||||
// Temp allocator is fine since we just need to identify which test it's referring to.
|
// Temp allocator is fine since we just need to identify which test it's referring to.
|
||||||
split_selector := strings.split(selector, ".", context.temp_allocator)
|
split_selector := strings.split(selector, ".", context.temp_allocator)
|
||||||
@@ -640,7 +640,7 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
|
|||||||
if total_success_count > 0 {
|
if total_success_count > 0 {
|
||||||
when USE_CLIPBOARD {
|
when USE_CLIPBOARD {
|
||||||
clipboard_writer := io.to_writer(bytes.buffer_to_stream(&clipboard_buffer))
|
clipboard_writer := io.to_writer(bytes.buffer_to_stream(&clipboard_buffer))
|
||||||
fmt.wprint(clipboard_writer, "-define:test_select=")
|
fmt.wprint(clipboard_writer, "-define:ODIN_TEST_NAMES=")
|
||||||
for test_index in sorted_failed_test_reasons {
|
for test_index in sorted_failed_test_reasons {
|
||||||
#no_bounds_check it := internal_tests[test_index]
|
#no_bounds_check it := internal_tests[test_index]
|
||||||
fmt.wprintf(clipboard_writer, "%s.%s,", it.pkg, it.name)
|
fmt.wprintf(clipboard_writer, "%s.%s,", it.pkg, it.name)
|
||||||
@@ -655,7 +655,7 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
|
|||||||
"" if total_failure_count == 1 else "s",
|
"" if total_failure_count == 1 else "s",
|
||||||
" has" if total_failure_count == 1 else "s have")
|
" has" if total_failure_count == 1 else "s have")
|
||||||
} else {
|
} else {
|
||||||
fmt.wprintf(batch_writer, "\nTo run only the failed test%s, use:\n\t-define:test_select=",
|
fmt.wprintf(batch_writer, "\nTo run only the failed test%s, use:\n\t-define:ODIN_TEST_NAMES=",
|
||||||
"" if total_failure_count == 1 else "s")
|
"" if total_failure_count == 1 else "s")
|
||||||
for test_index in sorted_failed_test_reasons {
|
for test_index in sorted_failed_test_reasons {
|
||||||
#no_bounds_check it := internal_tests[test_index]
|
#no_bounds_check it := internal_tests[test_index]
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
ODIN=../../odin
|
ODIN=../../odin
|
||||||
PYTHON=$(shell which python3)
|
PYTHON=$(shell which python3)
|
||||||
COMMON=-no-bounds-check -vet -strict-style -define:test_track_memory=true
|
COMMON=-no-bounds-check -vet -strict-style -define:ODIN_TEST_TRACK_MEMORY=true
|
||||||
COLLECTION=-collection:tests=..
|
COLLECTION=-collection:tests=..
|
||||||
|
|
||||||
all: all_bsd \
|
all: all_bsd \
|
||||||
@@ -34,13 +34,13 @@ download_test_assets:
|
|||||||
$(PYTHON) download_assets.py
|
$(PYTHON) download_assets.py
|
||||||
|
|
||||||
image_test:
|
image_test:
|
||||||
$(ODIN) test image $(COMMON) -define:test_progress_width=12 -out:test_core_image
|
$(ODIN) test image $(COMMON) -define:ODIN_TEST_PROGRESS_WIDTH=12 -out:test_core_image
|
||||||
|
|
||||||
compress_test:
|
compress_test:
|
||||||
$(ODIN) test compress $(COMMON) -define:test_progress_width=3 -out:test_core_compress
|
$(ODIN) test compress $(COMMON) -define:ODIN_TEST_PROGRESS_WIDTH=3 -out:test_core_compress
|
||||||
|
|
||||||
container_test:
|
container_test:
|
||||||
$(ODIN) test container $(COMMON) -define:test_progress_width=4 -out:test_core_container
|
$(ODIN) test container $(COMMON) -define:ODIN_TEST_PROGRESS_WIDTH=4 -out:test_core_container
|
||||||
|
|
||||||
crypto_test:
|
crypto_test:
|
||||||
$(ODIN) test crypto $(COMMON) -define:test_progress_width=18 -o:speed -out:test_crypto
|
$(ODIN) test crypto $(COMMON) -define:test_progress_width=18 -o:speed -out:test_crypto
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
@echo off
|
@echo off
|
||||||
set COMMON=-no-bounds-check -vet -strict-style -define:test_track_memory=true
|
set COMMON=-no-bounds-check -vet -strict-style -define:ODIN_TEST_TRACK_MEMORY=true
|
||||||
set COLLECTION=-collection:tests=..
|
set COLLECTION=-collection:tests=..
|
||||||
set PATH_TO_ODIN==..\..\odin
|
set PATH_TO_ODIN==..\..\odin
|
||||||
python3 download_assets.py
|
python3 download_assets.py
|
||||||
echo ---
|
echo ---
|
||||||
echo Running core:compress tests
|
echo Running core:compress tests
|
||||||
echo ---
|
echo ---
|
||||||
%PATH_TO_ODIN% test compress %COMMON% -define:test_progress_width=3 -out:test_core_compress.exe || exit /b
|
%PATH_TO_ODIN% test compress %COMMON% -define:ODIN_TEST_PROGRESS_WIDTH=3 -out:test_core_compress.exe || exit /b
|
||||||
|
|
||||||
echo ---
|
echo ---
|
||||||
echo Running core:container tests
|
echo Running core:container tests
|
||||||
echo ---
|
echo ---
|
||||||
%PATH_TO_ODIN% test container %COMMON% -define:test_progress_width=4 -out:test_core_container.exe || exit /b
|
%PATH_TO_ODIN% test container %COMMON% -define:ODIN_TEST_PROGRESS_WIDTH=4 -out:test_core_container.exe || exit /b
|
||||||
|
|
||||||
echo ---
|
echo ---
|
||||||
echo Running core:crypto tests
|
echo Running core:crypto tests
|
||||||
@@ -25,7 +25,7 @@ rem %PATH_TO_ODIN% run encoding/hxa %COMMON% %COLLECTION% -out:test_hxa.exe |
|
|||||||
%PATH_TO_ODIN% run encoding/json %COMMON% -out:test_json.exe || exit /b
|
%PATH_TO_ODIN% run encoding/json %COMMON% -out:test_json.exe || exit /b
|
||||||
%PATH_TO_ODIN% run encoding/varint %COMMON% -out:test_varint.exe || exit /b
|
%PATH_TO_ODIN% run encoding/varint %COMMON% -out:test_varint.exe || exit /b
|
||||||
%PATH_TO_ODIN% run encoding/xml %COMMON% -out:test_xml.exe || exit /b
|
%PATH_TO_ODIN% run encoding/xml %COMMON% -out:test_xml.exe || exit /b
|
||||||
%PATH_TO_ODIN% test encoding/cbor %COMMON% -out:test_cbor.exe -define:test_threads=1 -define:test_fancy=false || exit /b
|
%PATH_TO_ODIN% test encoding/cbor %COMMON% -out:test_cbor.exe -define:ODIN_TEST_THREADS=1 -define:ODIN_TEST_FANCY=false || exit /b
|
||||||
%PATH_TO_ODIN% run encoding/hex %COMMON% -out:test_hex.exe || exit /b
|
%PATH_TO_ODIN% run encoding/hex %COMMON% -out:test_hex.exe || exit /b
|
||||||
%PATH_TO_ODIN% run encoding/base64 %COMMON% -out:test_base64.exe || exit /b
|
%PATH_TO_ODIN% run encoding/base64 %COMMON% -out:test_base64.exe || exit /b
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ echo ---
|
|||||||
echo ---
|
echo ---
|
||||||
echo Running core:image tests
|
echo Running core:image tests
|
||||||
echo ---
|
echo ---
|
||||||
%PATH_TO_ODIN% test image %COMMON% -define:test_progress_width=12 -out:test_core_image.exe || exit /b
|
%PATH_TO_ODIN% test image %COMMON% -define:ODIN_TEST_PROGRESS_WIDTH=12 -out:test_core_image.exe || exit /b
|
||||||
|
|
||||||
echo ---
|
echo ---
|
||||||
echo Running core:math tests
|
echo Running core:math tests
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
@echo off
|
@echo off
|
||||||
odin test . -define:test_track_memory=true -define:test_progress_width=12 -vet -strict-style
|
odin test . -define:ODIN_TEST_TRACK_MEMORY=true -define:ODIN_TEST_PROGRESS_WIDTH=12 -vet -strict-style
|
||||||
|
|||||||
Reference in New Issue
Block a user