Commit Graph

284 Commits

Author SHA1 Message Date
Niels Boehm df82adca43 Add function testing whether a bitmask is valid.
This one verifies bitmasks where low bits are set to 1 (hence the name).
Any stray 0 among the lower ones or any stray 1 among the higher zeros
renders the mask invalid.

The edge cases of all zeros and all ones are considered valid masks.

It uses an efficient implementation. It's the counterpart of
https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
2017-06-22 20:22:53 +02:00
Léo Lam 5243eae4e9 UnitTests: Use a temporary profile directory
This prevents Dolphin from modifying any file in the user directory.
2017-06-18 16:23:09 +02:00
Léo Lam 6c3069be97 IOS/ESFormats: Use SignedBlobReader for TMDs and tickets 2017-06-14 22:45:29 +02:00
shuffle2 ffd8309aca Merge branch 'master' into fix-unittests 2017-06-07 21:20:06 -07:00
Shawn Hoffman 1bb26dddb1 msbuild: only set /NODEFAULTLIB in one place 2017-06-07 17:30:05 -07:00
Shawn Hoffman a2358786dc unittests: set user directory so SYSCONF does not get created at the drive root 2017-06-06 04:07:13 -07:00
Sepalani 5fb26abb17 StringUtil: Add StringPopBackIf UnitTests 2017-06-06 05:50:45 +01:00
shuffle2 c8166951a0 Merge pull request #5418 from MerryMage/config-again-and-again
VideoConfig: Port to layered configuration system
2017-06-05 21:11:04 -07:00
Michael Maltese 80710984dc DSPTool: extract tests into a DSPAssemblyTest
- Moves all test code from DSPTool into UnitTests/Core/DSPAssemblyTest.
- Converts test files (which could only be loaded if they were in the
  shell's working directory, so basically never) into C++ values.
- Enables most of the commented-out tests.
- Removes non-deterministic random code test.
2017-06-05 19:28:40 -07:00
Léo Lam d9fd056803 Fix minor formatting issues
These were not caught by the lint script while it was broken.
2017-06-05 02:32:19 +02:00
Shawn Hoffman 09367c8c10 msbuild: remove more duplicate code 2017-06-03 18:20:41 -07:00
Shawn Hoffman ddae5058e9 msbuild: increment other version numbers to vs2017 equivalents 2017-06-03 18:20:39 -07:00
MerryMage 41afe78a44 Config: Integrate 2017-06-03 18:11:57 +01:00
shuffle2 3443454ba2 Merge pull request #5271 from JosJuice/allow-aslr
Allow (but don't force) ASLR
2017-06-02 21:53:02 -07:00
BhaaL 072c161445 upgrade to Windows SDK 10.0.15063.0
this is required for /permissive- to work, because some headers in the
Windows SDK use Microsoft extensions that are not allowed in standards mode
2017-05-28 13:37:31 +02:00
Michael Maltese f6e1da0dc0 AudioCommon: add Cubeb backend 2017-05-27 18:28:56 -07:00
Pierre Bourdon d592bdd4d4 Migrate to Visual Studio 2017.
Auto-generated by the IDE, I'll trust it knows what it's doing.
2017-05-25 15:58:59 -07:00
Michael Maltese 974ada25e4 CMake: use RUNTIME_OUTPUT_DIRECTORY rather than setting OUTPUT_NAME each time 2017-05-22 00:19:14 -07:00
Michael Maltese 6d403d9ad4 CMake: specify unittests libs directly in target_link_libraries 2017-05-22 00:19:14 -07:00
Michael Maltese 8e57a0ff14 CMake: remove explicit platform libraries from UnitTests
They're not used directly, and any libraries that need them will pull
them in transitively.
2017-05-22 00:19:14 -07:00
Michael Maltese be2f4466e3 CMake: move unittests target to UnitTests 2017-05-22 00:19:14 -07:00
Michael Maltese ea35549e00 CMake: don't explictly create Tests/ directory 2017-05-22 00:19:13 -07:00
Michael Maltese 41fb6db6e3 CMake: remove extraneous TestUtils directory 2017-05-22 00:19:13 -07:00
Michael Maltese 87d64afe19 CMake: pass all srcs to add_test in ARGN 2017-05-22 00:19:13 -07:00
Michael Maltese 9d130b52f7 CMake: use unittests_stubhost object library 2017-05-22 00:19:13 -07:00
Michael Maltese a78ca46d9e CMake: use implicit target location in add_test 2017-05-22 00:19:13 -07:00
Michael Maltese 942cbd3c8d CMake: don't prefix test targets with Test_
The current prefixing makes it harder to build test executables directly
from the command line, since the target name breaks CMake convention and
doesn't match the name passed to `add_dolphin_test`. They all have "Test"
somewhere in the name anyways.
2017-05-22 00:19:13 -07:00
JosJuice e019872d62 Remove no-pie build flags 2017-05-20 09:35:53 +02:00
Helios747 a465c483f3 Remove D3D12 2017-05-18 17:01:12 -07:00
spycrab e66ad018f4 Convert VolumeDirectory names back to SHIFT-JIS (issue #9988) 2017-05-01 14:08:47 +02:00
Markus Wick 34ac749b8b Merge pull request #5144 from MerryMage/mfspr
Jit_SystemRegisters: Make mfspr PIE-compliant
2017-04-10 22:30:56 +02:00
Léo Lam 47a09de019 Add unit tests for IOS/ESFormats
This adds unit tests for IOS/ESFormats, and in particular, for the
TMDReader. It is tested using invalid TMDs (to check IsValid()) and
two valid, properly signed TMDs.

Things which are now tested:

* Title type helper functions.
* TMDReader: Validity check.
* TMDReader: General information returned by the Get*() methods.
* TMDReader: Raw TMD and generated TMD view, compared against IOS.
* TMDReader: Game ID generation code (which is Dolphin specific).
* TMDReader: Content information: getting by ID/index, order, metadata.
2017-04-05 20:54:11 +02:00
MerryMage 38917a151d CoreTiming: Pull globals into a single struct 2017-04-05 10:22:48 +01:00
Michael Maltese b305a6c575 VertexLoaderTest: fix maybe-uninitialized warning
Fixes warning:

```
../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:222:15: error: variable 'f' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
    ExpectOut(f * scale);
              ^
../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:198:12: note: initialize the variable 'f' to silence this warning
    float f, g;
           ^
            = 0.0
../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:223:15: error: variable 'g' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
    ExpectOut(g * scale);
              ^
../Source/UnitTests/VideoCommon/VertexLoaderTest.cpp:198:15: note: initialize the variable 'g' to silence this warning
    float f, g;
              ^
               = 0.0
```
2017-03-31 13:51:20 -07:00
Mat M 6a595aabe9 Merge pull request #5153 from ligfx/stubhostnorequestfullscreen
StubHost: remove unused Host_RequestFullscreen()
2017-03-31 00:21:04 -04:00
Mat M 774d2420e3 Merge pull request #5158 from ligfx/coretimingstatic
CoreTimingTest: make AdvanceAndCheck() static (fix warning)
2017-03-31 00:09:20 -04:00
Matthew Parlane e05b6cf3f4 Merge pull request #5155 from ligfx/expecttruefalse
UnitTests: use EXPECT_TRUE/EXPECT_FALSE (fixes warnings)
2017-03-26 14:53:17 +13:00
Michael Maltese 0c28ff2acc CoreTimingTest: make AdvanceAndCheck() static (fix warning)
Fixes warning:

```
../Source/UnitTests/Core/CoreTimingTest.cpp: In function 'void AdvanceAndCheck(u32, int, int, int)':
../Source/UnitTests/Core/CoreTimingTest.cpp:52:6: error: no previous declaration for 'void AdvanceAndCheck(u32, int, int, int)' [-Werror=missing-declarations]
 void AdvanceAndCheck(u32 idx, int downcount, int expected_lateness = 0, int cpu_downcount = 0)
      ^
```
2017-03-24 21:37:34 -07:00
Michael Maltese 04db3d5a50 UnitTests: use EXPECT_TRUE/EXPECT_FALSE (fixes warnings)
Using `EXPECT_EQ` with boolean literals can cause a warning in certain
versions of GCC. See https://github.com/google/googletest/issues/322

Fixes warnings:

```
../Source/UnitTests/Common/BitSetTest.cpp: In member function 'virtual void BitSet_Basics_Test::TestBody()':
../Source/UnitTests/Common/BitSetTest.cpp:15:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/BitSetTest.cpp: In member function 'virtual void BitSet_BitGetSet_Test::TestBody()':
../Source/UnitTests/Common/BitSetTest.cpp:27:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp: In member function 'virtual void StringUtil_StringBeginsWith_Test::TestBody()':
../Source/UnitTests/Common/StringUtilTest.cpp:23:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:25:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:26:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:27:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp: In member function 'virtual void StringUtil_StringEndsWith_Test::TestBody()':
../Source/UnitTests/Common/StringUtilTest.cpp:35:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:37:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:38:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
../Source/UnitTests/Common/StringUtilTest.cpp:39:165: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]
c
```
2017-03-24 17:26:27 -07:00
Michael Maltese 9234ed82da BitUtilsTest: compare ints of the same signedness (fixes warnings)
Fixes warnings like:

```
dolphin/Source/UnitTests/Common/BitUtilsTest.cpp:5:
../Externals/gtest/googletest/include/gtest/gtest.h:1392:11: warning: comparison of integers of different signs: 'const unsigned long' and 'const int' [-Wsign-compare]
  if (lhs == rhs) {
      ~~~ ^  ~~~
../Externals/gtest/googletest/include/gtest/gtest.h:1421:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned long, int>' requested here
    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
           ^
dolphin/Source/UnitTests/Common/BitUtilsTest.cpp:12:3: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
  EXPECT_EQ(Common::BitSize<s8>(),  8);
  ^
../Externals/gtest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
                      EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
```
2017-03-24 17:15:37 -07:00
Michael Maltese 5d69e99943 StubHost: remove unused Host_RequestFullscreen()
Fixes warning:

```
../Source/UnitTests/TestUtils/StubHost.cpp: In function 'void Host_RequestFullscreen(bool)':
../Source/UnitTests/TestUtils/StubHost.cpp:39:6: error: no previous declaration for 'void Host_RequestFullscreen(bool)' [-Werror=missing-declarations]
 void Host_RequestFullscreen(bool)
      ^
```
2017-03-24 16:41:12 -07:00
Lioncash 552c0d8404 Common: Move byte swapping utilities into their own header
This moves all the byte swapping utilities into a header named Swap.h.

A dedicated header is much more preferable here due to the size of the
code itself. In general usage throughout the codebase, CommonFuncs.h was
generally only included for these functions anyway. These being in their
own header avoids dumping the lesser used utilities into scope. As well
as providing a localized area for more utilities related to byte
swapping in the future (should they be needed). This also makes it nicer
to identify which files depend on the byte swapping utilities in
particular.

Since this is a completely new header, moving the code uncovered a few
indirect includes, as well as making some other inclusions unnecessary.
2017-03-03 17:18:18 -05:00
Lioncash ee61bd6f2e CMakeLists: Normalize whitespace
Normalizes tabs to spaces to follow our codebase's indentation style.
2017-03-01 14:53:23 -05:00
Mat M a3ba169e7d Merge pull request #4809 from Orphis/cmake_windows
CMake for Windows: getting a working binary!
2017-02-03 08:33:13 -05:00
Florent Castelli 3842a9b71c OpenAL: Move Windows binaries to lib folder and fix CMake detection
The module FindOpenAL is looking for the dll in a folder called lib, not x64.
This is only used on Windows x64, it's fine to remove the platform name.
2017-02-03 04:54:54 +01:00
Florent Castelli 9180c87197 cmake: Put test targets in folders 2017-02-03 04:23:24 +01:00
Florent Castelli e5f576f862 gtest: Update to latest version from git 2017-01-26 03:14:08 +01:00
Florent Castelli 223e213bcf cmake: Change endmacro(.*) to endmacro() 2017-01-25 15:07:32 +01:00
Lioncash 0a6f0dfb74 Common: Add bit utility header
This attempts to make some bit arithmetic more self-documenting and also
make it easier during review to identify potential off-by-one errors by
making it possible to just specify which bits are being extracted.

Functions both support the case where bits being extracted can vary and
fixed bit extraction. In the case the bits are fixed, compile-time asserts
are present to prevent accidental API usage at compile-time.

e.g. Instead of shifting and masking to get bits 10 to 15,
Common::ExtractBits<10, 15>(value) can just be done instead.
2017-01-14 11:16:02 -05:00
Léo Lam 8bef7259e3 Add the g_ prefix to the jit global
Jan 04 22:55:01 <leoetlino>   fwiw, it looks like there are new warnings in the RegCache code
Jan 04 22:55:04 <leoetlino>   Source/Core/Core/PowerPC/Jit64/FPURegCache.cpp:13:33: warning: declaration shadows a variable in the global namespace [-Wshadow]
Jan 04 22:56:19 <@Lioncash>   yeah, the jit global should have a g_ prefix.

This fixes shadowing warnings and adds the g_ prefix to a global.
2017-01-07 23:19:49 +01:00
BhaaL 23d99f2f2c specify custom brace style to fix unions
BreakBeforeBraces: Allman apparently includes all styles,
except for AfterUnion (which is false) when using clang-format -dump-config
2017-01-05 12:55:13 +01:00
Sepalani a6114bad34 Import/Export signature files as CSV 2016-12-18 00:27:10 +00:00
JosJuice 0c6fd47460 Add unit test for StringUtil's newly added JoinStrings 2016-11-27 22:11:14 +01:00
JosJuice 841e5893f4 IOS HLE: Add unit test for path/filename escaping 2016-11-27 22:11:05 +01:00
Jules Blok 8203ea929b BlockingLoop: Yield to UI message pump while waiting. 2016-11-11 13:37:02 +01:00
degasus 05eff01229 Android: Update the gradle file to use android studio 2.2 cmake. 2016-10-05 23:44:10 +02:00
Stenzek 77a128ab87 Implement experimental Vulkan backend 2016-10-01 02:40:01 +10:00
EmptyChaos 2e14920e16 CoreTiming: Guarantee FIFO processing of timed events
The min-heap provides no ordering when the key is the same on 2
nodes. Disambiguate identical times by tracking the order items
were added into the queue.
2016-09-08 19:46:42 +10:00
EmptyChaos 59465911d7 CoreTiming: Fix scheduling into the past
ForceExceptionCheck messes up the downcount and slice length if the
callback is scheduled into the past (g_slice_length becomes negative)
2016-09-03 14:55:44 +10:00
EmptyChaos ac63e54473 [UnitTests] Add CoreTimingTest 2016-09-03 14:55:44 +10:00
Lioncash e01c143379 Common: namespace MemoryUtil 2016-08-07 13:03:07 -04:00
degasus 3b3cbc4aab BusyLoopTest: Only run 10 times.
Running this test 100 times is not worth to spend 1 second.
2016-06-27 22:06:52 +02:00
Pierre Bourdon 6ed001ad42 Merge pull request #3954 from delroth/x64-emitter-test
x64EmitterTest: fill cpu_info with 0x01 instead of 0xFF to make gcc happier
2016-06-27 02:38:10 +02:00
Pierre Bourdon a910a4309f x64EmitterTest: fill cpu_info with 0x01 instead of 0xFF to make gcc happier 2016-06-27 01:55:42 +02:00
degasus d79aeaa1e9 VideoCommon: Drop GetConfigName.
We're past 5.0 now, so there is no need to look for old inis.
2016-06-26 12:34:59 +02:00
degasus fdbda7b7dd Null: Create Visual Studio project file.
Why is this so stupid on linux.....
2016-06-25 22:40:23 +02:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Lioncash 8d9221a71e MathUtilTest: Fix tests on MSVC - Document compiler bug
MSVC's implementation of numeric_limits currently generates incorrect
signaling NaNs. The resulting values are actually quiet NaNs instead.

This commit is based off of a solution by shuffle2. The only
difference is a template specialization for floats is also added
to cover all bases
2016-04-03 19:16:47 -04:00
Lioncash b3c77fd96a VertexLoaderTest: Amend code to fix new warnings in Visual Studio
Fixes warning C4334
2016-03-30 21:00:08 -04:00
hdcmeta 8cc686b360 D3D12: Initial commit for D3D12 backend implementation. 2016-02-15 09:48:25 -08:00
Chris Burgener c34fb3edf0 Use ffmpeg for Windows Video Dumping instead of VFW 2016-01-07 18:37:58 -05:00
Lioncash 8371c428cd VertexLoaderBase: Get rid of explicit delete and new 2015-12-22 20:09:54 -05:00
Lioncash f295182833 VideoBackends: Simplify initialization and deinitialization of resources
Approximately three or four times now, the issue of pointers being
in an inconsistent state been an issue in the video backend renderers
with regards to tripping up other developers.

Global (ugh) resources are put into a unique_ptr and will always have a
well-defined state of being - null or not null
2015-12-20 22:40:37 -05:00
Ryan Houdek 1a638175d2 Enable the page fault test on targets that aren't x86_64 2015-11-19 00:51:29 -06:00
Scott Mansell 95f3c956a8 Move GL interface code out of the OpenGL video backend. 2015-09-22 00:36:45 +12:00
Lioncash 8ce04f9a65 General: Replace GC_ALIGN macros with alignas
Standard supported alignment -> out with compiler-specific.
2015-09-06 12:53:51 -04:00
Lioncash 3f1b488a12 CommonFuncs: Replace ArraySize define with constexpr equivalent 2015-09-03 23:47:14 -04:00
Shawn Hoffman aa7208e270 [windows] Update projects to vs2015. 2015-09-03 04:23:01 -07:00
Lioncash caec42135d MathUtil: Remove IsNAN and IsINF
These aren't necessary, since the stdlib provides equivalents.
2015-08-21 15:05:43 -04:00
Tillmann Karras 439fb26b9b x64Emitter: add MOVSLDUP/MOVSHDUP 2015-08-06 10:39:43 +02:00
Matthew Parlane f32cede086 Revert "x64: build a Position-Independent Executable (PIE)" 2015-06-14 16:06:26 +12:00
degasus c375111076 Options: merge SCoreStartupParameter into SConfig 2015-06-12 19:07:45 +02:00
Ryan Houdek 59e2225f7d Remove ARMv7 support. 2015-06-07 22:44:13 -05:00
flacs d3e47dfcf5 Merge pull request #2496 from Tilka/fma4
Jit64: add FMA4 support to fmaddXX
2015-06-06 17:31:55 +02:00
Tillmann Karras d4538c762f MemoryUtil: get executable pages near static data
and clean up a bit.
2015-06-03 21:44:31 +02:00
comex 0c5aa54606 Merge pull request #2470 from degasus/syncgpu
Common: Blocking Loop (extracted from Fifo.cpp)
2015-06-02 20:19:00 -04:00
Tillmann Karras 8db6588bb9 XEmitter: add FMA4 instructions 2015-06-02 19:19:52 +02:00
degasus 9c730b0a1f Unittests: Add BlockingLoopTest 2015-05-30 13:40:36 +02:00
Scott Mansell f57517f1a0 Clean up cached_arraybases. Update VideoSW to new scheme.
Move ownership of cached_arraybases from CPMemory to VertexLoaderManager
to better match it usage.
2015-05-30 04:09:27 +12:00
Ryan Houdek 69963dc4b0 Merge pull request #2274 from degasus/disable_bbox
Disable bbox
2015-05-25 08:46:12 -04:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Tillmann Karras 268f52e054 Add missing license headers 2015-05-25 13:11:47 +02:00
degasus 6b2a1e57e2 BBox: remove now unreachable SW bbox implementation 2015-05-25 09:33:34 +02:00
Fiora 22317ac74c Merge pull request #2417 from Tilka/vex
XEmitter: VEX-related cleanup

I'm merging this solely because of the FMA3 error message
2015-05-18 16:23:23 -07:00
Tillmann Karras c2c31086ae XEmitter: restructure WriteVEXOp wrappers 2015-05-17 18:44:56 +02:00
yerejm e4e1fe5a9c Reset faked CPU extension support at test end to ensure test isolation. 2015-05-17 11:48:05 +10:00
Tillmann Karras 9793fed742 XEmitter: add PUNPCKLQDQ 2015-03-18 12:09:06 +01:00
Tillmann Karras 8d90ecda7f VertexLoaders: make positions more compact 2015-03-18 12:09:06 +01:00
Tillmann Karras 49ae99ffc9 UnitTests: rewrite vertex loader tests
The position attribute now has complete coverage.
2015-03-18 12:09:06 +01:00
Tillmann Karras f82afd1b2f Fix warnings 2015-03-16 19:02:30 +01:00