Skip to content

Commit 5938bdc

Browse files
jplexergmarull
authored andcommitted
build: move tests wscript to wscript_build
Signed-off-by: Joshua Jun <lets@throw.rocks>
1 parent ae94819 commit 5938bdc

2 files changed

Lines changed: 127 additions & 129 deletions

File tree

tests/wscript renamed to tests/wscript_build

Lines changed: 110 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -257,135 +257,117 @@ def convert_pdc_to_pbi(ctx):
257257

258258
return test_pdc_pbis
259259

260-
def options(opt):
261-
gr = opt.add_option_group('test options')
262-
gr.add_option('-D', '--debug_test', action='store_true',
263-
help='Execute tests within GDB. Use alongside -M.')
264-
gr.add_option('-M', '--match', dest='regex', default=None, action='store',
265-
help='Run regex match tests. Example: ./waf test -M "test.*resource.*"')
266-
gr.add_option('-L', '--list_tests', dest='list_tests', action='store_true',
267-
help='List all test names. Usually used in conjunction with -M. Example: '
268-
'./waf test -M test_animation -L')
269-
gr.add_option('-T', '--test_name', dest='test_name', default=None, action='store',
270-
help='Run only the given test name. Usually used in conjunction with -M. Example: '
271-
'./waf test -M test_animation -T unschedule')
272-
gr.add_option('-C', '--coverage', dest='coverage', action='store_true', help='Generate gcov test coverage data and use lcov to generate HTML report')
273-
gr.add_option('--show_output', action='store_true', help='show test output')
274-
gr.add_option('--no_run', action='store_true', help='Do not run the tests, just build them')
275-
gr.add_option('--no_images', action='store_true', help='skip generation of test images, '
276-
'which are only required for some tests and can slow down build times')
277-
278-
def build(bld):
279-
if bld.options.debug_test:
280-
if not bld.options.regex:
281-
bld.fatal('When using --debug_test, you must also use --match to'
282-
' specify the test file to debug')
283-
bld.env.append_value('DEFINES', 'UNITTEST_DEBUG')
284-
285-
bld.env.CFLAGS.append('-I' + bld.path.abspath() + '/../src/fw/util/time')
286-
bld.env.CFLAGS.append('-I' + bld.path.abspath() + '/../include')
287-
288-
# clang on Linux errors on true == true or false == false compile-time assertions
289-
bld.env.CFLAGS.append('-Wno-tautological-compare')
290-
291-
# Any test in this list won't be compiled
292-
bld.env.BROKEN_TESTS = [
293-
'test_app_fetch_endpoint.c',
294-
'test_graphics_draw_text_flow.c',
295-
'test_perimeter.c',
296-
'test_ancs_pebble_actions.c',
297-
'test_timeline_actions.c',
298-
'test_bluetooth_persistent_storage_prf.c',
299-
'test_session.c',
300-
'test_session_receive_router.c',
301-
'test_compositor.c',
302-
'test_floor.c',
303-
'test_pow.c',
304-
'test_ams.c',
305-
'test_ams_util.c',
306-
'test_gap_le_advert.c',
307-
'test_bt_conn_mgr.c',
308-
'test_gatt_client_accessors.c',
309-
'test_gatt_client_discovery.c',
310-
'test_gatt_client_subscriptions.c',
311-
'test_gatt_service_changed_client.c',
312-
'test_gatt_service_changed_server.c',
313-
'test_gap_le_connect.c',
314-
'test_ancs_util.c',
315-
'test_ancs.c',
316-
'test_kernel_le_client.c',
317-
'test_ppogatt.c',
318-
'test_graphics_circle.c',
319-
'test_action_menu_window.c',
320-
'test_activity_insights.c',
321-
'test_app_menu_data_source.c',
322-
'test_battery_monitor.c',
323-
'test_battery_ui_fsm.c',
324-
'test_data_logging.c',
325-
'test_emoji_fonts.c',
326-
'test_graphics_draw_circle_1bit.c',
327-
'test_graphics_draw_circle_8bit.c',
328-
'test_graphics_draw_line.c',
329-
'test_graphics_draw_rotated_bitmap.c',
330-
'test_graphics_fill_circle_1bit.c',
331-
'test_graphics_fill_circle_8bit.c',
332-
'test_graphics_gtransform_1bit.c',
333-
'test_graphics_gtransform_8bit.c',
334-
'test_kickstart.c',
335-
'test_launcher_menu_layer.c',
336-
'test_pfs.c',
337-
'test_selection_windows.c',
338-
'test_system_theme.c',
339-
'test_timeline_peek_event.c',
340-
'test_timezone_database.c',
341-
'test_wakeup.c',
342-
'test_blob_db2_endpoint.c'
343-
]
344-
345-
# Don't run the python tool tests because they exercise a lot of old python2 code that still needs to be updated
346-
bld.env.PYTHON_TOOL_TESTS_DISABLED = True
347-
348-
# Disable warning promotion. Not ideal, but gets most of the tests running again without straight up disabling the new warnings
349-
bld.env.CFLAGS.append('-Wno-error')
350-
351-
# Many tests operate on a set of test images and require tools to process these
352-
# images and therefore need extra defines. Set up our environment first before running any
353-
# tests.
354-
test_images_dest_dir = bld.path.find_node('test_images').get_bld()
355-
356-
# Set up the fail directory, and make it. This is used to output data from the tests for
357-
# comparison with the expected results.
358-
fail_dir = test_images_dest_dir.parent.make_node('failed')
359-
fail_path = fail_dir.abspath().strip()
360-
sh.rm('-rf', fail_path)
361-
fail_dir.mkdir()
362-
363-
bld.env.test_image_defines = [
364-
'TEST_IMAGES_PATH="%s"' % test_images_dest_dir.abspath(),
365-
'TEST_OUTPUT_PATH="%s"' % fail_dir.abspath(),
366-
'PBI2PNG_EXE="%s"' % bld.path.find_node('../tools/pbi2png.py').abspath()]
367-
368-
# Add test_pbis or test_pngs to runtime_deps for tests that require them
369-
if not bld.options.no_images:
370-
bld.env.test_pbis = generate_test_pbis(bld)
371-
bld.env.test_pngs = copy_test_pngs_to_build_dir(bld)
372-
bld.env.test_pngs.extend(generate_test_pngs(bld))
373-
bld.env.test_pfos = copy_pfo_files_to_build_dir(bld)
374-
# Includes reference pdc and pbi generated from ref png
375-
bld.env.test_pdcs = bld.env.test_pbis + convert_test_pdcs(bld) + copy_pdc_files_to_build_dir(bld)
376-
bld.env.pdcs2png_test_files = bld.env.test_pbis + convert_pdc_to_pbi(bld)
377260

378-
if bld.options.coverage:
379-
bld.env.append_value('CFLAGS', '-fprofile-arcs')
380-
bld.env.append_value('CFLAGS', '-ftest-coverage')
381-
bld.env.append_value('LINKFLAGS', '--coverage')
382-
test_wscript_dirs = sorted({os.path.dirname(f.abspath())
383-
for f in bld.path.ant_glob(['**/wscript', '**/wscript_build'])})
384-
for dir in test_wscript_dirs:
385-
bld.recurse(dir)
386-
if bld.options.coverage:
387-
bld.add_pre_fun(remove_old_coverage_files)
388-
bld.add_post_fun(update_lcov)
261+
if bld.options.debug_test:
262+
if not bld.options.regex:
263+
bld.fatal('When using --debug_test, you must also use --match to'
264+
' specify the test file to debug')
265+
bld.env.append_value('DEFINES', 'UNITTEST_DEBUG')
266+
267+
bld.env.CFLAGS.append('-I' + bld.path.abspath() + '/../src/fw/util/time')
268+
bld.env.CFLAGS.append('-I' + bld.path.abspath() + '/../include')
269+
270+
# clang on Linux errors on true == true or false == false compile-time assertions
271+
bld.env.CFLAGS.append('-Wno-tautological-compare')
272+
273+
# Any test in this list won't be compiled
274+
bld.env.BROKEN_TESTS = [
275+
'test_app_fetch_endpoint.c',
276+
'test_graphics_draw_text_flow.c',
277+
'test_perimeter.c',
278+
'test_ancs_pebble_actions.c',
279+
'test_timeline_actions.c',
280+
'test_bluetooth_persistent_storage_prf.c',
281+
'test_session.c',
282+
'test_session_receive_router.c',
283+
'test_compositor.c',
284+
'test_floor.c',
285+
'test_pow.c',
286+
'test_ams.c',
287+
'test_ams_util.c',
288+
'test_gap_le_advert.c',
289+
'test_bt_conn_mgr.c',
290+
'test_gatt_client_accessors.c',
291+
'test_gatt_client_discovery.c',
292+
'test_gatt_client_subscriptions.c',
293+
'test_gatt_service_changed_client.c',
294+
'test_gatt_service_changed_server.c',
295+
'test_gap_le_connect.c',
296+
'test_ancs_util.c',
297+
'test_ancs.c',
298+
'test_kernel_le_client.c',
299+
'test_ppogatt.c',
300+
'test_graphics_circle.c',
301+
'test_action_menu_window.c',
302+
'test_activity_insights.c',
303+
'test_app_menu_data_source.c',
304+
'test_battery_monitor.c',
305+
'test_battery_ui_fsm.c',
306+
'test_data_logging.c',
307+
'test_emoji_fonts.c',
308+
'test_graphics_draw_circle_1bit.c',
309+
'test_graphics_draw_circle_8bit.c',
310+
'test_graphics_draw_line.c',
311+
'test_graphics_draw_rotated_bitmap.c',
312+
'test_graphics_fill_circle_1bit.c',
313+
'test_graphics_fill_circle_8bit.c',
314+
'test_graphics_gtransform_1bit.c',
315+
'test_graphics_gtransform_8bit.c',
316+
'test_kickstart.c',
317+
'test_launcher_menu_layer.c',
318+
'test_pfs.c',
319+
'test_selection_windows.c',
320+
'test_system_theme.c',
321+
'test_timeline_peek_event.c',
322+
'test_timezone_database.c',
323+
'test_wakeup.c',
324+
'test_blob_db2_endpoint.c'
325+
]
326+
327+
# Don't run the python tool tests because they exercise a lot of old python2 code that still needs to be updated
328+
bld.env.PYTHON_TOOL_TESTS_DISABLED = True
329+
330+
# Disable warning promotion. Not ideal, but gets most of the tests running again without straight up disabling the new warnings
331+
bld.env.CFLAGS.append('-Wno-error')
332+
333+
# Many tests operate on a set of test images and require tools to process these
334+
# images and therefore need extra defines. Set up our environment first before running any
335+
# tests.
336+
test_images_dest_dir = bld.path.find_node('test_images').get_bld()
337+
338+
# Set up the fail directory, and make it. This is used to output data from the tests for
339+
# comparison with the expected results.
340+
fail_dir = test_images_dest_dir.parent.make_node('failed')
341+
fail_path = fail_dir.abspath().strip()
342+
sh.rm('-rf', fail_path)
343+
fail_dir.mkdir()
344+
345+
bld.env.test_image_defines = [
346+
'TEST_IMAGES_PATH="%s"' % test_images_dest_dir.abspath(),
347+
'TEST_OUTPUT_PATH="%s"' % fail_dir.abspath(),
348+
'PBI2PNG_EXE="%s"' % bld.path.find_node('../tools/pbi2png.py').abspath()]
349+
350+
# Add test_pbis or test_pngs to runtime_deps for tests that require them
351+
if not bld.options.no_images:
352+
bld.env.test_pbis = generate_test_pbis(bld)
353+
bld.env.test_pngs = copy_test_pngs_to_build_dir(bld)
354+
bld.env.test_pngs.extend(generate_test_pngs(bld))
355+
bld.env.test_pfos = copy_pfo_files_to_build_dir(bld)
356+
# Includes reference pdc and pbi generated from ref png
357+
bld.env.test_pdcs = bld.env.test_pbis + convert_test_pdcs(bld) + copy_pdc_files_to_build_dir(bld)
358+
bld.env.pdcs2png_test_files = bld.env.test_pbis + convert_pdc_to_pbi(bld)
359+
360+
if bld.options.coverage:
361+
bld.env.append_value('CFLAGS', '-fprofile-arcs')
362+
bld.env.append_value('CFLAGS', '-ftest-coverage')
363+
bld.env.append_value('LINKFLAGS', '--coverage')
364+
test_wscript_dirs = sorted({os.path.dirname(f.abspath())
365+
for f in bld.path.ant_glob(['**/wscript', '**/wscript_build'])})
366+
for dir in test_wscript_dirs:
367+
bld.recurse(dir)
368+
if bld.options.coverage:
369+
bld.add_pre_fun(remove_old_coverage_files)
370+
bld.add_post_fun(update_lcov)
389371

390372

391373
# vim:filetype=python

wscript

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,24 @@ def options(opt):
7171
opt.load('pebble_arm_gcc', tooldir='waftools')
7272
opt.load('show_configure', tooldir='waftools')
7373
opt.load('kconfig', tooldir='waftools')
74-
opt.recurse('tests')
7574
opt.recurse('src/fw')
75+
76+
gr = opt.add_option_group('test options')
77+
gr.add_option('-D', '--debug_test', action='store_true',
78+
help='Execute tests within GDB. Use alongside -M.')
79+
gr.add_option('-M', '--match', dest='regex', default=None, action='store',
80+
help='Run regex match tests. Example: ./waf test -M "test.*resource.*"')
81+
gr.add_option('-L', '--list_tests', dest='list_tests', action='store_true',
82+
help='List all test names. Usually used in conjunction with -M. Example: '
83+
'./waf test -M test_animation -L')
84+
gr.add_option('-T', '--test_name', dest='test_name', default=None, action='store',
85+
help='Run only the given test name. Usually used in conjunction with -M. Example: '
86+
'./waf test -M test_animation -T unschedule')
87+
gr.add_option('-C', '--coverage', dest='coverage', action='store_true', help='Generate gcov test coverage data and use lcov to generate HTML report')
88+
gr.add_option('--show_output', action='store_true', help='show test output')
89+
gr.add_option('--no_run', action='store_true', help='Do not run the tests, just build them')
90+
gr.add_option('--no_images', action='store_true', help='skip generation of test images, '
91+
'which are only required for some tests and can slow down build times')
7692
opt.add_option('--board', action='store',
7793
choices=[ 'asterix',
7894
'obelix_dvt',

0 commit comments

Comments
 (0)