Update code as old template and generator is replaced with new one

This commit is contained in:
Azim Khan 2017-06-09 15:02:36 +01:00 committed by Mohammad Azim Khan
parent 191e904bb2
commit 1de892b85f
3 changed files with 23 additions and 25 deletions

View file

@ -176,6 +176,8 @@ func.test_suite_version := test_suite_version
.PHONY: all check test clean .PHONY: all check test clean
all: $(BINARIES)
$(DEP): $(DEP):
$(MAKE) -C ../library $(MAKE) -C ../library
@ -184,12 +186,11 @@ $(DEP):
C_FILES := $(addsuffix .c,$(APPS)) C_FILES := $(addsuffix .c,$(APPS))
.SECONDEXPANSION: .SECONDEXPANSION:
$(C_FILES): %.c: suites/$$(func.$$*).function suites/%.data scripts/gen_mbed_code.py suites/helpers.function suites/mbed_test.function suites/desktop_test.function $(C_FILES): %.c: suites/$$(func.$$*).function suites/%.data scripts/generate_code.py suites/helpers.function suites/main_test.function suites/desktop_test.function
echo " Gen $@" echo " Gen $@"
# perl scripts/generate_code.pl suites $(func.$*) $* python scripts/generate_code.py -f suites/$(func.$*).function \
python scripts/gen_mbed_code.py -f suites/$(func.$*).function \
-d suites/$*.data \ -d suites/$*.data \
-t suites/mbed_test.function \ -t suites/main_test.function \
-p suites/desktop_test.function \ -p suites/desktop_test.function \
-s suites \ -s suites \
--help-file suites/helpers.function \ --help-file suites/helpers.function \
@ -201,9 +202,6 @@ $(BINARIES): %$(EXEXT): %.c $(DEP)
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
all: $(BINARIES)
clean: clean:
ifndef WINDOWS ifndef WINDOWS
rm -rf $(APPS) *.c *.data TESTS rm -rf $(APPS) *.c *.data TESTS
@ -217,8 +215,8 @@ check: $(BINARIES)
test: check test: check
# Create separate targets for generating mbed-os tests. # Create separate targets for generating embedded tests.
MBED_APPS := $(addprefix mbed_,$(APPS)) EMBEDDED_TESTS := $(addprefix embedded_,$(APPS))
# FIXME: description needs change # FIXME: description needs change
# Each test suite name is stripped off of prefix test_suite_. mbed-os test dir # Each test suite name is stripped off of prefix test_suite_. mbed-os test dir
@ -228,15 +226,15 @@ MBED_APPS := $(addprefix mbed_,$(APPS))
# name is used as the test group dir. # name is used as the test group dir.
.SECONDEXPANSION: .SECONDEXPANSION:
$(MBED_APPS): mbed_%: suites/$$(func.$$*).function suites/%.data scripts/gen_mbed_code.py suites/helpers.function suites/mbed_test.function suites/embedded_test.function $(EMBEDDED_TESTS): embedded_%: suites/$$(func.$$*).function suites/%.data scripts/generate_code.py suites/helpers.function suites/main_test.function suites/embedded_test.function
echo " Gen ./TESTS/mbedtls/$*/$*.c" echo " Gen ./TESTS/mbedtls/$*/$*.c"
python scripts/gen_mbed_code.py -f suites/$(func.$*).function \ python scripts/generate_code.py -f suites/$(func.$*).function \
-d suites/$*.data \ -d suites/$*.data \
-t suites/mbed_test.function \ -t suites/main_test.function \
-p suites/embedded_test.function \ -p suites/embedded_test.function \
-s suites \ -s suites \
--help-file suites/helpers.function \ --help-file suites/helpers.function \
-o ./TESTS/mbedtls/$* -o ./TESTS/mbedtls/$*
gen-mbed-test: $(MBED_APPS) gen-embedded-test: $(EMBEDDED_TESTS)

View file

@ -27,14 +27,14 @@ Generates code in following structure.
<output dir>/ <output dir>/
|-- host_tests/ |-- host_tests/
| |-- mbedtls_test.py | |-- mbedtls_test.py
| |-- suites/
| | |-- *.data files
| |-- mbedtls/ | |-- mbedtls/
| | |-- <test suite #1>/ | | |-- <test suite #1>/
| | | |-- main.c | | | |-- main.c
| | | |-- *.data files
| | ... | | ...
| | |-- <test suite #n>/ | | |-- <test suite #n>/
| | | |-- main.c | | | |-- main.c
| | | |-- *.data files
| | | | | |
""" """
@ -504,7 +504,7 @@ def gen_from_test_data(data_f, out_data_f, func_info):
return dep_check_code, expression_code return dep_check_code, expression_code
def gen_mbed_code(funcs_file, data_file, template_file, platform_file, help_file, suites_dir, c_file, out_data_file): def generate_code(funcs_file, data_file, template_file, platform_file, help_file, suites_dir, c_file, out_data_file):
""" """
Generate mbed-os test code. Generate mbed-os test code.
@ -627,7 +627,7 @@ def check_cmd():
if not os.path.exists(d): if not os.path.exists(d):
os.makedirs(d) os.makedirs(d)
gen_mbed_code(args.funcs_file, args.data_file, args.template_file, args.platform_file, generate_code(args.funcs_file, args.data_file, args.template_file, args.platform_file,
args.help_file, args.suites_dir, out_c_file, out_data_file) args.help_file, args.suites_dir, out_c_file, out_data_file)

View file

@ -1,4 +1,4 @@
#line 2 "suites/mbed_test.function" #line 2 "suites/main_test.function"
/* /*
* *** THIS FILE HAS BEEN MACHINE GENERATED *** * *** THIS FILE HAS BEEN MACHINE GENERATED ***
* *
@ -31,7 +31,7 @@
{test_common_helpers} {test_common_helpers}
#line {line_no} "suites/mbed_test.function" #line {line_no} "suites/main_test.function"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -44,7 +44,7 @@
{functions_code} {functions_code}
#line {line_no} "suites/mbed_test.function" #line {line_no} "suites/main_test.function"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -66,7 +66,7 @@
int get_expression( int32_t exp_id, int32_t * out_value ) int get_expression( int32_t exp_id, int32_t * out_value )
{{ {{
{expression_code} {expression_code}
#line {line_no} "suites/mbed_test.function" #line {line_no} "suites/main_test.function"
{{ {{
return( KEY_VALUE_MAPPING_NOT_FOUND ); return( KEY_VALUE_MAPPING_NOT_FOUND );
}} }}
@ -88,7 +88,7 @@ int get_expression( int32_t exp_id, int32_t * out_value )
int dep_check( int dep_id ) int dep_check( int dep_id )
{{ {{
{dep_check_code} {dep_check_code}
#line {line_no} "suites/mbed_test.function" #line {line_no} "suites/main_test.function"
{{ {{
return( DEPENDENCY_NOT_SUPPORTED ); return( DEPENDENCY_NOT_SUPPORTED );
}} }}
@ -116,7 +116,7 @@ typedef void (*TestWrapper_t)( void ** );
TestWrapper_t test_funcs[] = TestWrapper_t test_funcs[] =
{{ {{
{dispatch_code} {dispatch_code}
#line {line_no} "suites/mbed_test.function" #line {line_no} "suites/main_test.function"
}}; }};
@ -153,7 +153,7 @@ int dispatch_test( int func_idx, void ** params )
{platform_code} {platform_code}
#line {line_no} "suites/mbed_test.function" #line {line_no} "suites/main_test.function"
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Main Test code */ /* Main Test code */