Incorporated code review comments

This commit is contained in:
Mohammad Azim Khan 2017-07-19 10:15:54 +01:00 committed by Mohammad Azim Khan
parent d61b837fac
commit 9540261a76
7 changed files with 41 additions and 37 deletions

View file

@ -36,6 +36,7 @@ set(NULL_ENTROPY_WARNING "${WARNING_BORDER}"
"${NULL_ENTROPY_WARN_L3}" "${NULL_ENTROPY_WARN_L3}"
"${WARNING_BORDER}") "${WARNING_BORDER}")
find_package(PythonInterp)
find_package(Perl) find_package(Perl)
if(PERL_FOUND) if(PERL_FOUND)

View file

@ -29,8 +29,8 @@ function(add_test_suite suite_name)
add_custom_command( add_custom_command(
OUTPUT test_suite_${data_name}.c OUTPUT test_suite_${data_name}.c
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.py -f ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function -d ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data -t ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function -p ${CMAKE_CURRENT_SOURCE_DIR}/suites/desktop_test.function -s ${CMAKE_CURRENT_SOURCE_DIR}/suites --help-file ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function -o . COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.py -f ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function -d ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data -t ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function -p ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function -s ${CMAKE_CURRENT_SOURCE_DIR}/suites --help-file ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function -o .
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.py mbedtls ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/desktop_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.py mbedtls ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data
) )
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -2,7 +2,7 @@
# To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS # To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
# To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS
CFLAGS ?= -g3 #-O2 CFLAGS ?= -O2
WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wno-unused-function -Wno-unused-value WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wno-unused-function -Wno-unused-value
LDFLAGS ?= LDFLAGS ?=
@ -186,12 +186,12 @@ $(DEP):
C_FILES := $(addsuffix .c,$(APPS)) C_FILES := $(addsuffix .c,$(APPS))
.SECONDEXPANSION: .SECONDEXPANSION:
$(C_FILES): %.c: suites/$$(func.$$*).function suites/%.data scripts/generate_code.py suites/helpers.function suites/main_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/host_test.function
echo " Gen $@" echo " Gen $@"
python scripts/generate_code.py -f suites/$(func.$*).function \ python scripts/generate_code.py -f suites/$(func.$*).function \
-d suites/$*.data \ -d suites/$*.data \
-t suites/main_test.function \ -t suites/main_test.function \
-p suites/desktop_test.function \ -p suites/host_test.function \
-s suites \ -s suites \
--help-file suites/helpers.function \ --help-file suites/helpers.function \
-o . -o .
@ -218,20 +218,15 @@ test: check
# Create separate targets for generating embedded tests. # Create separate targets for generating embedded tests.
EMBEDDED_TESTS := $(addprefix embedded_,$(APPS)) EMBEDDED_TESTS := $(addprefix embedded_,$(APPS))
# FIXME: description needs change # Generate test code for target.
# Each test suite name is stripped off of prefix test_suite_. mbed-os test dir
# structure requires format TESTS/<testgroup>[/<sub testgroups..>]/<test case>
# Test app names are split on "." and end part is used as the test dir name.
# Prevous parts are used as the test group dirs. For tests without "." same
# name is used as the test group dir.
.SECONDEXPANSION: .SECONDEXPANSION:
$(EMBEDDED_TESTS): embedded_%: suites/$$(func.$$*).function suites/%.data scripts/generate_code.py suites/helpers.function suites/main_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/target_test.function
echo " Gen ./TESTS/mbedtls/$*/$*.c" echo " Gen ./TESTS/mbedtls/$*/$*.c"
python scripts/generate_code.py -f suites/$(func.$*).function \ python scripts/generate_code.py -f suites/$(func.$*).function \
-d suites/$*.data \ -d suites/$*.data \
-t suites/main_test.function \ -t suites/main_test.function \
-p suites/embedded_test.function \ -p suites/target_test.function \
-s suites \ -s suites \
--help-file suites/helpers.function \ --help-file suites/helpers.function \
-o ./TESTS/mbedtls/$* -o ./TESTS/mbedtls/$*

View file

@ -1,18 +1,22 @@
""" """
mbed TLS Test suites code generator.
Copyright (c) 2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License"); Copyright (C) 2006-2017, ARM Limited, All Rights Reserved
you may not use this file except in compliance with the License. SPDX-License-Identifier: Apache-2.0
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software http://www.apache.org/licenses/LICENSE-2.0
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Unless required by applicable law or agreed to in writing, software
See the License for the specific language governing permissions and distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
limitations under the License. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file is part of mbed TLS (https://tls.mbed.org)
""" """
import os import os

View file

@ -1,18 +1,22 @@
""" """
mbed SDK Greentea host test script for on-target tests.
Copyright (c) 2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License"); Copyright (C) 2006-2017, ARM Limited, All Rights Reserved
you may not use this file except in compliance with the License. SPDX-License-Identifier: Apache-2.0
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software http://www.apache.org/licenses/LICENSE-2.0
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Unless required by applicable law or agreed to in writing, software
See the License for the specific language governing permissions and distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
limitations under the License. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file is part of mbed TLS (https://tls.mbed.org)
""" """
import re import re

View file

@ -1,4 +1,4 @@
#line 2 "suites/desktop_test.function" #line 2 "suites/host_test.function"
/** /**
* \brief Varifies that string is in string parameter format i.e. "<str>" * \brief Varifies that string is in string parameter format i.e. "<str>"

View file

@ -1,4 +1,4 @@
#line 2 "embedded_test.function" #line 2 "suites/target_test.function"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"