Split unit tests into separate directories (#1761)
The unit tests should follow the component structure, so this patch moves all `jerry-core` unit tests under `tests/unit-core` and the `jerry-libm` unit tests under `tests/unit-libm`. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+4
-1
@@ -239,5 +239,8 @@ endif()
|
||||
|
||||
# Unittests
|
||||
if(UNITTESTS)
|
||||
add_subdirectory(tests/unit)
|
||||
add_subdirectory(tests/unit-core)
|
||||
if(JERRY_LIBM)
|
||||
add_subdirectory(tests/unit-libm)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (Unittest C)
|
||||
project (unit-core C)
|
||||
|
||||
if (NOT IS_ABSOLUTE ${FEATURE_PROFILE})
|
||||
set(FEATURE_PROFILE "${CMAKE_SOURCE_DIR}/jerry-core/profiles/${FEATURE_PROFILE}.profile")
|
||||
@@ -27,7 +27,7 @@ endif()
|
||||
file(GLOB SOURCE_UNIT_TEST_MAIN_MODULES *.c)
|
||||
|
||||
# Unit tests declaration
|
||||
add_custom_target(unittests)
|
||||
add_custom_target(unittests-core)
|
||||
|
||||
foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
|
||||
get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE)
|
||||
@@ -41,5 +41,5 @@ foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} jerry-core)
|
||||
|
||||
add_dependencies(unittests ${TARGET_NAME})
|
||||
add_dependencies(unittests-core ${TARGET_NAME})
|
||||
endforeach()
|
||||
@@ -0,0 +1,41 @@
|
||||
# Copyright JS Foundation and other contributors, http://js.foundation
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (unit-libm C)
|
||||
|
||||
# Unit tests main modules
|
||||
file(GLOB SOURCE_UNIT_TEST_MAIN_MODULES *.c)
|
||||
|
||||
# Unit tests declaration
|
||||
add_custom_target(unittests-libm)
|
||||
|
||||
foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
|
||||
get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE)
|
||||
set(TARGET_NAME unit-${TARGET_NAME})
|
||||
|
||||
add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_MAIN})
|
||||
set_property(TARGET ${TARGET_NAME}
|
||||
PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
|
||||
|
||||
link_directories(${CMAKE_BINARY_DIR})
|
||||
|
||||
set(TARGET_LIBS jerry-libm)
|
||||
if(JERRY_LIBC)
|
||||
set(TARGET_LIBS ${TARGET_LIBS} jerry-libc)
|
||||
endif()
|
||||
target_link_libraries(${TARGET_NAME} ${TARGET_LIBS})
|
||||
|
||||
add_dependencies(unittests-libm ${TARGET_NAME})
|
||||
endforeach()
|
||||
@@ -17,7 +17,10 @@
|
||||
* Unit test for jerry-libm
|
||||
*/
|
||||
|
||||
#include "test-common.h"
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static bool passed = true;
|
||||
|
||||
@@ -13,10 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generated by tools/gen-test-libm.sh
|
||||
* DO NOT EDIT!!!
|
||||
*/
|
||||
/* This file is automatically generated by the gen-test-libm.sh script.
|
||||
* Do not edit! */
|
||||
|
||||
check_double ("acos (0.0)", acos (0.0), 1.57079632679489655800E+00);
|
||||
check_double ("acos (-0.0)", acos (-0.0), 1.57079632679489655800E+00);
|
||||
check_double ("acos (1.0)", acos (1.0), 0.00000000000000000000E+00);
|
||||
@@ -15,5 +15,5 @@
|
||||
# limitations under the License.
|
||||
|
||||
make -C tools/unit-tests build
|
||||
tools/unit-tests/gen-test-libm >tests/unit/test-libm.inc.h
|
||||
tools/unit-tests/gen-test-libm >tests/unit-libm/test-libm.inc.h
|
||||
make -C tools/unit-tests clean
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
int
|
||||
main (int argc, char **args)
|
||||
{
|
||||
printf ("/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
printf ("/* Copyright JS Foundation and other contributors, http://js.foundation\n"
|
||||
" *\n"
|
||||
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
|
||||
" * you may not use this file except in compliance with the License.\n"
|
||||
@@ -47,10 +47,9 @@ main (int argc, char **args)
|
||||
" * limitations under the License.\n"
|
||||
" */\n"
|
||||
"\n"
|
||||
"/*\n"
|
||||
" * Generated by tools/gen-test-libm.sh\n"
|
||||
" * DO NOT EDIT!!!\n"
|
||||
" */\n");
|
||||
"/* This file is automatically generated by the gen-test-libm.sh script.\n"
|
||||
" * Do not edit! */\n"
|
||||
"\n");
|
||||
|
||||
/* acos tests */
|
||||
GEN_DBL_TEST (acos (0.0));
|
||||
|
||||
Reference in New Issue
Block a user