-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows tests to use "meson test" instead of a shell script. This also means that they now fully respect user-specified toolchain (e.g. clang compiler, custom CFLAGS, etc). Running C++ test is conditional on enabling INIReader support in the build. ``` 1/16 test_multi OK 0.05s 2/16 test_multi_max_line OK 0.04s 3/16 test_single OK 0.04s 4/16 test_disallow_inline_comments OK 0.03s 5/16 test_stop_on_first_error OK 0.03s 6/16 test_handler_lineno OK 0.02s 7/16 test_heap OK 0.06s 8/16 test_string OK 0.06s 9/16 test_heap_max_line OK 0.05s 10/16 test_heap_realloc OK 0.05s 11/16 test_heap_realloc_max_line OK 0.05s 12/16 test_heap_string OK 0.04s 13/16 test_call_handler_on_new_section OK 0.04s 14/16 test_allow_no_value OK 0.03s 15/16 test_alloc OK 0.02s 16/16 test_INIReaderExample OK 0.02s Ok: 16 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0 ```
- Loading branch information
Showing
5 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
runtest = files(join_paths(meson.project_source_root(), 'runtest.sh')) | ||
|
||
unittest_INIReaderExample = executable('unittest_INIReaderExample', src_inih, src_INIReader, 'INIReaderExample.cpp', cpp_args : ['-Wall']) | ||
test('test_INIReaderExample', runtest, depends : [unittest_INIReaderExample], args : [files('cpptest.txt'), unittest_INIReaderExample.full_path()]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
cd "$(dirname "${1}")" | ||
diff "${1}" <("${2}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
runtest = files(join_paths(meson.project_source_root(), 'runtest.sh')) | ||
|
||
unittest_multi = executable('unittest_multi', src_inih, 'unittest.c', c_args : ['-Wall']) | ||
test('test_multi', runtest, depends : [unittest_multi], args : [files('baseline_multi.txt'), unittest_multi.full_path()]) | ||
|
||
unittest_multi_max_line = executable('unittest_multi_max_line', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_MAX_LINE=20']) | ||
test('test_multi_max_line', runtest, depends : [unittest_multi_max_line], args : [files('baseline_multi_max_line.txt'), unittest_multi_max_line.full_path()]) | ||
|
||
unittest_single = executable('unittest_single', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_ALLOW_MULTILINE=0']) | ||
test('test_single', runtest, depends : [unittest_single], args : [files('baseline_single.txt'), unittest_single.full_path()]) | ||
|
||
unittest_disallow_inline_comments = executable('unittest_disallow_inline_comments', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_ALLOW_INLINE_COMMENTS=0']) | ||
test('test_disallow_inline_comments', runtest, depends : [unittest_disallow_inline_comments], args : [files('baseline_disallow_inline_comments.txt'), unittest_disallow_inline_comments.full_path()]) | ||
|
||
unittest_stop_on_first_error = executable('unittest_stop_on_first_error', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_STOP_ON_FIRST_ERROR=1']) | ||
test('test_stop_on_first_error', runtest, depends : [unittest_stop_on_first_error], args : [files('baseline_stop_on_first_error.txt'), unittest_stop_on_first_error.full_path()]) | ||
|
||
unittest_handler_lineno = executable('unittest_handler_lineno', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_HANDLER_LINENO=1']) | ||
test('test_handler_lineno', runtest, depends : [unittest_handler_lineno], args : [files('baseline_handler_lineno.txt'), unittest_handler_lineno.full_path()]) | ||
|
||
unittest_string = executable('unittest_string', src_inih, 'unittest_string.c', c_args : ['-Wall', '-DINI_MAX_LINE=20']) | ||
test('test_string', runtest, depends : [unittest_string], args : [files('baseline_string.txt'), unittest_string.full_path()]) | ||
|
||
unittest_heap = executable('unittest_heap', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_USE_STACK=0']) | ||
test('test_heap', runtest, depends : [unittest_heap], args : [files('baseline_heap.txt'), unittest_heap.full_path()]) | ||
|
||
unittest_heap_max_line = executable('unittest_heap_max_line', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_INITIAL_ALLOC=20']) | ||
test('test_heap_max_line', runtest, depends : [unittest_heap_max_line], args : [files('baseline_heap_max_line.txt'), unittest_heap_max_line.full_path()]) | ||
|
||
unittest_heap_realloc = executable('unittest_heap_realloc', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_USE_STACK=0', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=5']) | ||
test('test_heap_realloc', runtest, depends : [unittest_heap_realloc], args : [files('baseline_heap_realloc.txt'), unittest_heap_realloc.full_path()]) | ||
|
||
unittest_heap_realloc_max_line = executable('unittest_heap_realloc_max_line', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=5']) | ||
test('test_heap_realloc_max_line', runtest, depends : [unittest_heap_realloc_max_line], args : [files('baseline_heap_realloc_max_line.txt'), unittest_heap_realloc_max_line.full_path()]) | ||
|
||
unittest_heap_string = executable('unittest_heap_string', src_inih, 'unittest_string.c', c_args : ['-Wall', '-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_INITIAL_ALLOC=20']) | ||
test('test_heap_string', runtest, depends : [unittest_heap_string], args : [files('baseline_heap_string.txt'), unittest_heap_string.full_path()]) | ||
|
||
unittest_call_handler_on_new_section = executable('unittest_call_handler_on_new_section', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_CALL_HANDLER_ON_NEW_SECTION=1']) | ||
test('test_call_handler_on_new_section', runtest, depends : [unittest_call_handler_on_new_section], args : [files('baseline_call_handler_on_new_section.txt'), unittest_call_handler_on_new_section.full_path()]) | ||
|
||
unittest_allow_no_value = executable('unittest_allow_no_value', src_inih, 'unittest.c', c_args : ['-Wall', '-DINI_ALLOW_NO_VALUE=1']) | ||
test('test_allow_no_value', runtest, depends : [unittest_allow_no_value], args : [files('baseline_allow_no_value.txt'), unittest_allow_no_value.full_path()]) | ||
|
||
unittest_alloc = executable('unittest_alloc', src_inih, 'unittest_alloc.c', c_args : ['-Wall', '-DINI_CUSTOM_ALLOCATOR=1', '-DINI_USE_STACK=0', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=12']) | ||
test('test_alloc', runtest, depends : [unittest_alloc], args : [files('baseline_alloc.txt'), unittest_alloc.full_path()]) |