summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2016-05-21 10:15:13 -0400
committerGravatar bunnei2016-05-21 10:15:13 -0400
commit5edff287b6da2821424e94d0ec48a00db2f7d944 (patch)
tree8236ee8438948f3612bf9fd9f7932449fff1567b
parentMerge pull request #1816 from JayFoxRox/refactor-tev-dump (diff)
parentTests: Run tests on CI (diff)
downloadyuzu-5edff287b6da2821424e94d0ec48a00db2f7d944.tar.gz
yuzu-5edff287b6da2821424e94d0ec48a00db2f7d944.tar.xz
yuzu-5edff287b6da2821424e94d0ec48a00db2f7d944.zip
Merge pull request #1564 from MerryMage/this-is-only-a-test
tests: Infrastructure for unit tests
-rw-r--r--.gitmodules3
-rwxr-xr-x.travis-build.sh9
-rw-r--r--CMakeLists.txt2
-rw-r--r--appveyor.yml9
m---------externals/catch0
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/tests/CMakeLists.txt16
-rw-r--r--src/tests/tests.cpp9
8 files changed, 47 insertions, 2 deletions
diff --git a/.gitmodules b/.gitmodules
index db0905b3d..1f0b80768 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,3 +10,6 @@
10[submodule "soundtouch"] 10[submodule "soundtouch"]
11 path = externals/soundtouch 11 path = externals/soundtouch
12 url = https://github.com/citra-emu/ext-soundtouch.git 12 url = https://github.com/citra-emu/ext-soundtouch.git
13[submodule "catch"]
14 path = externals/catch
15 url = https://github.com/philsquared/Catch.git
diff --git a/.travis-build.sh b/.travis-build.sh
index e06a4299b..511df04ac 100755
--- a/.travis-build.sh
+++ b/.travis-build.sh
@@ -18,9 +18,16 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then
18 mkdir build && cd build 18 mkdir build && cd build
19 cmake -DCITRA_FORCE_QT4=ON .. 19 cmake -DCITRA_FORCE_QT4=ON ..
20 make -j4 20 make -j4
21
22 ctest -VV -C Release
21elif [ "$TRAVIS_OS_NAME" = "osx" ]; then 23elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
24 set -o pipefail
25
22 export Qt5_DIR=$(brew --prefix)/opt/qt5 26 export Qt5_DIR=$(brew --prefix)/opt/qt5
27
23 mkdir build && cd build 28 mkdir build && cd build
24 cmake .. -GXcode 29 cmake .. -GXcode
25 xcodebuild -configuration Release | xcpretty -c && exit ${PIPESTATUS[0]} 30 xcodebuild -configuration Release | xcpretty -c
31
32 ctest -VV -C Release
26fi 33fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f2898973..f7b0af115 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -255,6 +255,8 @@ endif()
255 255
256add_subdirectory(externals/soundtouch) 256add_subdirectory(externals/soundtouch)
257 257
258enable_testing()
259
258add_subdirectory(src) 260add_subdirectory(src)
259 261
260# Install freedesktop.org metadata files, following those specifications: 262# Install freedesktop.org metadata files, following those specifications:
diff --git a/appveyor.yml b/appveyor.yml
index 1edd7041f..b2b0ae28b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -22,7 +22,14 @@ before_build:
22 - cmake -G "Visual Studio 14 2015 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 .. 22 - cmake -G "Visual Studio 14 2015 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 ..
23 - cd .. 23 - cd ..
24 24
25after_build: 25build:
26 project: build/citra.sln
27 parallel: true
28
29test_script:
30 - cd build && ctest -VV -C Release
31
32on_success:
26 # copying the needed QT Dlls is now done post build. See the CMakeLists.txt file in the citra-qt folder 33 # copying the needed QT Dlls is now done post build. See the CMakeLists.txt file in the citra-qt folder
27 - ps: > 34 - ps: >
28 if (!"$env:APPVEYOR_PULL_REQUEST_TITLE" -and ("$env:APPVEYOR_REPO_BRANCH" -eq "master")) 35 if (!"$env:APPVEYOR_PULL_REQUEST_TITLE" -and ("$env:APPVEYOR_REPO_BRANCH" -eq "master"))
diff --git a/externals/catch b/externals/catch
new file mode 160000
Subproject c984fc3ecde60b59efa2203e82261acac8ac850
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index de4fe716a..1e1245160 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,6 +5,7 @@ add_subdirectory(common)
5add_subdirectory(core) 5add_subdirectory(core)
6add_subdirectory(video_core) 6add_subdirectory(video_core)
7add_subdirectory(audio_core) 7add_subdirectory(audio_core)
8add_subdirectory(tests)
8if (ENABLE_SDL2) 9if (ENABLE_SDL2)
9 add_subdirectory(citra) 10 add_subdirectory(citra)
10endif() 11endif()
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
new file mode 100644
index 000000000..457c55571
--- /dev/null
+++ b/src/tests/CMakeLists.txt
@@ -0,0 +1,16 @@
1set(SRCS
2 tests.cpp
3 )
4
5set(HEADERS
6 )
7
8create_directory_groups(${SRCS} ${HEADERS})
9
10include_directories(../../externals/catch/single_include/)
11
12add_executable(tests ${SRCS} ${HEADERS})
13target_link_libraries(tests core video_core audio_core common)
14target_link_libraries(tests ${PLATFORM_LIBRARIES})
15
16add_test(NAME tests COMMAND $<TARGET_FILE:tests>)
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
new file mode 100644
index 000000000..73978676f
--- /dev/null
+++ b/src/tests/tests.cpp
@@ -0,0 +1,9 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#define CATCH_CONFIG_MAIN
6#include <catch.hpp>
7
8// Catch provides the main function since we've given it the
9// CATCH_CONFIG_MAIN preprocessor directive.