Rename generate_code.py -> generate_test_code.py

This commit is contained in:
Mohammad Azim Khan 2018-03-06 11:49:41 +00:00
parent 7eb55687c4
commit 78befd9019
5 changed files with 30 additions and 30 deletions

View File

@ -29,8 +29,8 @@ function(add_test_suite suite_name)
add_custom_command(
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/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/host_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_test_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_test_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})

View File

@ -195,9 +195,9 @@ $(DEP):
C_FILES := $(addsuffix .c,$(APPS))
.SECONDEXPANSION:
$(C_FILES): %.c: suites/$$(func.$$*).function suites/%.data scripts/generate_code.py suites/helpers.function suites/main_test.function suites/host_test.function
$(C_FILES): %.c: suites/$$(func.$$*).function suites/%.data scripts/generate_test_code.py suites/helpers.function suites/main_test.function suites/host_test.function
echo " Gen $@"
$(PYTHON) scripts/generate_code.py -f suites/$(func.$*).function \
$(PYTHON) scripts/generate_test_code.py -f suites/$(func.$*).function \
-d suites/$*.data \
-t suites/main_test.function \
-p suites/host_test.function \
@ -230,9 +230,9 @@ EMBEDDED_TESTS := $(addprefix embedded_,$(APPS))
# Generate test code for target.
.SECONDEXPANSION:
$(EMBEDDED_TESTS): embedded_%: suites/$$(func.$$*).function suites/%.data scripts/generate_code.py suites/helpers.function suites/main_test.function suites/target_test.function
$(EMBEDDED_TESTS): embedded_%: suites/$$(func.$$*).function suites/%.data scripts/generate_test_code.py suites/helpers.function suites/main_test.function suites/target_test.function
echo " Gen ./TESTS/mbedtls/$*/$*.c"
$(PYTHON) scripts/generate_code.py -f suites/$(func.$*).function \
$(PYTHON) scripts/generate_test_code.py -f suites/$(func.$*).function \
-d suites/$*.data \
-t suites/main_test.function \
-p suites/target_test.function \

View File

@ -1,6 +1,6 @@
# Test suites code generator.
#
# Copyright (C) 2006-2017, ARM Limited, All Rights Reserved
# Copyright (C) 2018, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,6 +1,6 @@
# Greentea host test script for on-target tests.
#
# Copyright (C) 2006-2017, ARM Limited, All Rights Reserved
# Copyright (C) 2018, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,6 +1,6 @@
# Unit test for generate_code.py
# Unit test for generate_test_code.py
#
# Copyright (C) 2006-2017, ARM Limited, All Rights Reserved
# Copyright (C) 2018, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -20,11 +20,11 @@
from StringIO import StringIO
from unittest import TestCase, main as unittest_main
from mock import patch
from generate_code import *
from generate_test_code import *
"""
Unit tests for generate_code.py
Unit tests for generate_test_code.py
"""
@ -510,7 +510,7 @@ void test_func()
s = StringIOWrapper('test_suite_ut.function', data)
self.assertRaises(InvalidFileFormat, parse_function_code, s, [], [])
@patch("generate_code.parse_function_signature")
@patch("generate_test_code.parse_function_signature")
def test_parse_function_signature_called(self, parse_function_signature_mock):
"""
Test parse_function_code()
@ -527,10 +527,10 @@ void test_func()
self.assertTrue(parse_function_signature_mock.called)
parse_function_signature_mock.assert_called_with('void test_func()\n')
@patch("generate_code.gen_dispatch")
@patch("generate_code.gen_deps")
@patch("generate_code.gen_function_wrapper")
@patch("generate_code.parse_function_signature")
@patch("generate_test_code.gen_dispatch")
@patch("generate_test_code.gen_deps")
@patch("generate_test_code.gen_function_wrapper")
@patch("generate_test_code.parse_function_signature")
def test_return(self, parse_function_signature_mock,
gen_function_wrapper_mock,
gen_deps_mock,
@ -572,10 +572,10 @@ exit:
self.assertEqual(code, expected)
self.assertEqual(dispatch_code, "\n test_func_wrapper,\n")
@patch("generate_code.gen_dispatch")
@patch("generate_code.gen_deps")
@patch("generate_code.gen_function_wrapper")
@patch("generate_code.parse_function_signature")
@patch("generate_test_code.gen_dispatch")
@patch("generate_test_code.gen_deps")
@patch("generate_test_code.gen_function_wrapper")
@patch("generate_test_code.parse_function_signature")
def test_with_exit_label(self, parse_function_signature_mock,
gen_function_wrapper_mock,
gen_deps_mock,
@ -620,7 +620,7 @@ class ParseFunction(TestCase):
Test Suite for testing parse_functions()
"""
@patch("generate_code.parse_until_pattern")
@patch("generate_test_code.parse_until_pattern")
def test_begin_header(self, parse_until_pattern_mock):
"""
Test that begin header is checked and parse_until_pattern() is called.
@ -640,7 +640,7 @@ class ParseFunction(TestCase):
parse_until_pattern_mock.assert_called_with(s, END_HEADER_REGEX)
self.assertEqual(s.line_no, 2)
@patch("generate_code.parse_until_pattern")
@patch("generate_test_code.parse_until_pattern")
def test_begin_helper(self, parse_until_pattern_mock):
"""
Test that begin helper is checked and parse_until_pattern() is called.
@ -661,7 +661,7 @@ void print_helloworld()
parse_until_pattern_mock.assert_called_with(s, END_SUITE_HELPERS_REGEX)
self.assertEqual(s.line_no, 2)
@patch("generate_code.parse_suite_deps")
@patch("generate_test_code.parse_suite_deps")
def test_begin_dep(self, parse_suite_deps_mock):
"""
Test that begin dep is checked and parse_suite_deps() is called.
@ -680,7 +680,7 @@ void print_helloworld()
parse_suite_deps_mock.assert_called_with(s)
self.assertEqual(s.line_no, 2)
@patch("generate_code.parse_function_deps")
@patch("generate_test_code.parse_function_deps")
def test_begin_function_dep(self, parse_function_deps_mock):
"""
Test that begin dep is checked and parse_function_deps() is called.
@ -700,8 +700,8 @@ void print_helloworld()
parse_function_deps_mock.assert_called_with(deps_str)
self.assertEqual(s.line_no, 2)
@patch("generate_code.parse_function_code")
@patch("generate_code.parse_function_deps")
@patch("generate_test_code.parse_function_code")
@patch("generate_test_code.parse_function_deps")
def test_return(self, parse_function_deps_mock, parse_function_code_mock):
"""
Test that begin case is checked and parse_function_code() is called.
@ -1390,9 +1390,9 @@ class GenFromTestData(TestCase):
Test suite for gen_from_test_data()
"""
@patch("generate_code.write_deps")
@patch("generate_code.write_parameters")
@patch("generate_code.gen_suite_deps_checks")
@patch("generate_test_code.write_deps")
@patch("generate_test_code.write_parameters")
@patch("generate_test_code.gen_suite_deps_checks")
def test_intermediate_data_file(self, gen_suite_deps_checks_mock, write_parameters_mock, write_deps_mock):
"""
Test that intermediate data file is written with expected data.