Skip to content

Commit

Permalink
test: Build most tests with builtins enabled
Browse files Browse the repository at this point in the history
This allows the compiler to detect errors with various C library
functions, as well as testing how applications will actually use the
library.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Feb 8, 2023
1 parent 1299152 commit 3ffa43f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,8 @@ conf_data.set('_HAVE_SEMIHOST', has_semihost, description: 'Semihost APIs suppor

# By default, tests don't require any special arguments

# disable compiler built-ins so we reach the library equivalents
test_c_args = c_args + arg_fnobuiltin
test_c_args = c_args
# disable compiler built-ins so we don't use native equivalents
native_c_args += arg_fnobuiltin
if tests_enable_stack_protector
if cc.has_argument('-fstack-protector-all') and cc.has_argument('-fstack-protector-strong')
Expand Down
22 changes: 19 additions & 3 deletions test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,22 @@ foreach target : targets
env: test_env)
endif

t1 = 'math_errhandling'
if target == ''
t1_name = t1
else
t1_name = t1 + '_' + target
endif

test(t1_name,
executable(t1_name, ['math_errhandling.c'],
c_args: arg_fnobuiltin + _c_args,
link_args: _link_args,
link_with: _libs,
include_directories: inc),
depends: bios_bin,
env: test_env)

t1 = 'rounding-mode'
if target == ''
t1_name = t1
Expand All @@ -251,7 +267,7 @@ foreach target : targets

test(t1_name,
executable(t1_name, ['rounding-mode.c', 'rounding-mode-sub.c'],
c_args: _c_args,
c_args: arg_fnobuiltin + _c_args,
link_args: _link_args,
link_with: _libs,
include_directories: inc),
Expand All @@ -268,7 +284,7 @@ foreach target : targets

test(t1_name,
executable(t1_name, [t1_src, 'lock-valid.c'],
c_args: double_printf_compile_args + _c_args,
c_args: double_printf_compile_args + arg_fnobuiltin + _c_args,
link_args: double_printf_link_args + _link_args,
link_with: _libs,
link_depends: test_link_depends,
Expand Down Expand Up @@ -298,7 +314,7 @@ foreach target : targets
)

plain_tests = ['rand', 'regex', 'ungetc', 'fenv',
'math_errhandling', 'malloc', 'tls',
'malloc', 'tls',
'ffs', 'setjmp', 'atexit', 'on_exit',
'math-funcs', 'timegm', 'time-tests',
'test-strtod', 'test-strchr',
Expand Down

0 comments on commit 3ffa43f

Please sign in to comment.