summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoranonymous <local@localhost>2010-07-02 19:12:29 +0700
committeranonymous <local@localhost>2010-07-02 22:14:18 +0700
commit3310d8a2909b5759686452e68159cbca61038a40 (patch)
treec6c40d81352f6e251b67cd25a36c8e74592decae /test
parent2c08f2cdacd5f35cadc9b41a8aee9a28d14da939 (diff)
downloadlibcxxrt-3310d8a2909b5759686452e68159cbca61038a40.tar.gz
libcxxrt-3310d8a2909b5759686452e68159cbca61038a40.tar.bz2
libcxxrt-3310d8a2909b5759686452e68159cbca61038a40.tar.xz
cmake scripts for testing are added
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt35
-rw-r--r--test/expected_output.log21
-rwxr-xr-xtest/run_test.sh4
3 files changed, 60 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e69de29..6e6ea58 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -0,0 +1,35 @@
+
+set(CXXTEST_SOURCES
+ test.cc
+ test_exception.cc
+ test_guard.cc
+ test_typeinfo.cc
+ )
+
+
+add_executable(cxxrt-test-static ${CXXTEST_SOURCES})
+target_link_libraries(cxxrt-test-static cxxrt-static pthread dl)
+
+add_executable(cxxrt-test-shared ${CXXTEST_SOURCES})
+target_link_libraries(cxxrt-test-shared cxxrt-shared pthread dl)
+
+add_executable(system-test ${CXXTEST_SOURCES})
+
+file(READ "${CMAKE_CURRENT_SOURCE_DIR}/expected_output.log" expected_output)
+
+add_test(system-test-test
+ ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/system-test
+ ${CMAKE_CURRENT_SOURCE_DIR}/expected_output.log)
+
+add_test(cxxrt-test-static-test
+ ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cxxrt-test-static
+ ${CMAKE_CURRENT_SOURCE_DIR}/expected_output.log)
+
+add_test(cxxrt-test-shared-test
+ ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cxxrt-test-shared
+ ${CMAKE_CURRENT_SOURCE_DIR}/expected_output.log)
+
+
diff --git a/test/expected_output.log b/test/expected_output.log
new file mode 100644
index 0000000..6c95ecc
--- /dev/null
+++ b/test/expected_output.log
@@ -0,0 +1,21 @@
+Initialized static
+Initialized static
+Entering try
+Caught int 1!
+cl destroyed: 12
+Entering try
+Caught float 1.000000!
+cl destroyed: 12
+Entering try
+Caught struct {2}!
+cl destroyed: 12
+Entering try
+Caught struct {2}!
+cl destroyed: 12
+cl destroyed: 123
+Caught re-thrown float
+Entering try
+Caught int 0!
+cl destroyed: 12
+
+23 tests, 23 passed, 0 failed
diff --git a/test/run_test.sh b/test/run_test.sh
new file mode 100755
index 0000000..42795a7
--- /dev/null
+++ b/test/run_test.sh
@@ -0,0 +1,4 @@
+test_command=$1
+expected_output=$2
+$test_command > test_log 2>&1
+diff test_log $expected_output