mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
Merge branch 'master' into virtual_g27
This commit is contained in:
commit
9e3f477a73
9 changed files with 225 additions and 15 deletions
|
@ -43,8 +43,8 @@ cmake .. \
|
||||||
-DOpenGL_GL_PREFERENCE=LEGACY \
|
-DOpenGL_GL_PREFERENCE=LEGACY \
|
||||||
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
|
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
|
||||||
-DSTATIC_LINK_LLVM=ON \
|
-DSTATIC_LINK_LLVM=ON \
|
||||||
-DBUILD_RPCS3_TESTS=ON \
|
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
|
||||||
-DRUN_RPCS3_TESTS=ON \
|
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
|
||||||
-G Ninja
|
-G Ninja
|
||||||
|
|
||||||
ninja; build_status=$?;
|
ninja; build_status=$?;
|
||||||
|
|
|
@ -54,8 +54,8 @@ cmake .. \
|
||||||
-DOpenGL_GL_PREFERENCE=LEGACY \
|
-DOpenGL_GL_PREFERENCE=LEGACY \
|
||||||
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
|
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
|
||||||
-DSTATIC_LINK_LLVM=ON \
|
-DSTATIC_LINK_LLVM=ON \
|
||||||
-DBUILD_RPCS3_TESTS=ON \
|
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
|
||||||
-DRUN_RPCS3_TESTS=ON \
|
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
|
||||||
-G Ninja
|
-G Ninja
|
||||||
|
|
||||||
ninja; build_status=$?;
|
ninja; build_status=$?;
|
||||||
|
|
|
@ -8,6 +8,7 @@ BUILD_SOURCEBRANCHNAME
|
||||||
APPDIR
|
APPDIR
|
||||||
ARTDIR
|
ARTDIR
|
||||||
RELEASE_MESSAGE
|
RELEASE_MESSAGE
|
||||||
|
RUN_UNIT_TESTS
|
||||||
# Variables for build matrix
|
# Variables for build matrix
|
||||||
COMPILER
|
COMPILER
|
||||||
DEPLOY_APPIMAGE
|
DEPLOY_APPIMAGE
|
||||||
|
|
14
.github/workflows/rpcs3.yml
vendored
14
.github/workflows/rpcs3.yml
vendored
|
@ -56,6 +56,7 @@ jobs:
|
||||||
COMPILER: ${{ matrix.compiler }}
|
COMPILER: ${{ matrix.compiler }}
|
||||||
UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }}
|
UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }}
|
||||||
UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }}
|
UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }}
|
||||||
|
RUN_UNIT_TESTS: github.event_name == 'pull_request' && 'ON' || 'OFF'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
@ -132,6 +133,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup NuGet
|
||||||
|
uses: nuget/setup-nuget@v2
|
||||||
|
|
||||||
|
- name: Restore NuGet packages
|
||||||
|
run: nuget restore rpcs3.sln
|
||||||
|
|
||||||
- name: Setup env
|
- name: Setup env
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
|
@ -171,7 +178,12 @@ jobs:
|
||||||
|
|
||||||
- name: Compile RPCS3
|
- name: Compile RPCS3
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: msbuild rpcs3.sln /p:Configuration=Release /v:minimal /p:Platform=x64 /p:CLToolPath=${{ env.CCACHE_BIN_DIR }} /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="${{ github.workspace }}\buildfiles\msvc\ci_only.targets"
|
run: msbuild rpcs3.sln /p:Configuration=Release /v:minimal /p:Platform=x64 /p:PreferredToolArchitecture=x64 /p:CLToolPath=${{ env.CCACHE_BIN_DIR }} /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="${{ github.workspace }}\buildfiles\msvc\ci_only.targets"
|
||||||
|
|
||||||
|
- name: Run Unit Tests
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
shell: pwsh
|
||||||
|
run: build\lib\Release-x64\rpcs3_test.exe
|
||||||
|
|
||||||
- name: Pack up build artifacts
|
- name: Pack up build artifacts
|
||||||
run: |
|
run: |
|
||||||
|
|
2
3rdparty/FAudio
vendored
2
3rdparty/FAudio
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 091c6b4693ce507ac48037836a5a884e35cd2860
|
Subproject commit 6077ea740a7114a54f76ed9b7abe08cffc0034b6
|
|
@ -67,8 +67,8 @@ if (NOT ANDROID)
|
||||||
PUBLIC
|
PUBLIC
|
||||||
3rdparty::stblib
|
3rdparty::stblib
|
||||||
3rdparty::libevdev
|
3rdparty::libevdev
|
||||||
PRIVATE
|
|
||||||
rpcs3_emu
|
rpcs3_emu
|
||||||
|
PRIVATE
|
||||||
rpcs3_ui
|
rpcs3_ui
|
||||||
3rdparty::discordRPC
|
3rdparty::discordRPC
|
||||||
3rdparty::qt6
|
3rdparty::qt6
|
||||||
|
@ -187,9 +187,7 @@ if (NOT ANDROID)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Unit tests
|
# Unit tests
|
||||||
if(BUILD_RPCS3_TESTS AND CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
if(BUILD_RPCS3_TESTS)
|
||||||
message(STATUS "FIXME: Unit tests are currently not linking with GCC")
|
|
||||||
elseif(BUILD_RPCS3_TESTS)
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
find_package(GTest REQUIRED)
|
find_package(GTest REQUIRED)
|
||||||
|
|
||||||
|
@ -201,6 +199,7 @@ elseif(BUILD_RPCS3_TESTS)
|
||||||
PRIVATE
|
PRIVATE
|
||||||
tests/test.cpp
|
tests/test.cpp
|
||||||
tests/test_fmt.cpp
|
tests/test_fmt.cpp
|
||||||
|
tests/test_simple_array.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(rpcs3_test
|
target_link_libraries(rpcs3_test
|
||||||
|
|
|
@ -23,9 +23,9 @@ namespace rsx
|
||||||
Ty* _data = _local_capacity ? reinterpret_cast<Ty*>(_local_storage) : nullptr;
|
Ty* _data = _local_capacity ? reinterpret_cast<Ty*>(_local_storage) : nullptr;
|
||||||
u32 _size = 0;
|
u32 _size = 0;
|
||||||
|
|
||||||
inline u64 offset(const_iterator pos)
|
inline u32 offset(const_iterator pos)
|
||||||
{
|
{
|
||||||
return (_data) ? u64(pos - _data) : 0ull;
|
return (_data) ? u32(pos - _data) : 0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_local_storage() const
|
bool is_local_storage() const
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<BuildInSolution Condition="'$(GTestInstalled)' != 'true'">false</BuildInSolution>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{d1cbf84e-07f8-4acb-9cd2-bd205fdeee1e}</ProjectGuid>
|
<ProjectGuid>{d1cbf84e-07f8-4acb-9cd2-bd205fdeee1e}</ProjectGuid>
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
@ -37,6 +40,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
<PreprocessorDefinitions>X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
@ -59,6 +63,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
<PreprocessorDefinitions>X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||||
|
@ -77,12 +82,13 @@
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup Condition="'$(GTestInstalled)' == 'true'">
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="'$(GTestInstalled)' == 'true'">
|
<ItemGroup>
|
||||||
<ClCompile Include="test.cpp" />
|
<ClCompile Include="test.cpp" />
|
||||||
<ClCompile Include="test_fmt.cpp" />
|
<ClCompile Include="test_fmt.cpp" />
|
||||||
|
<ClCompile Include="test_simple_array.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets" Condition="'$(GTestInstalled)' == 'true'">
|
<ImportGroup Label="ExtensionTargets" Condition="'$(GTestInstalled)' == 'true'">
|
||||||
|
|
192
rpcs3/tests/test_simple_array.cpp
Normal file
192
rpcs3/tests/test_simple_array.cpp
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#define private public
|
||||||
|
#include "Emu/RSX/Common/simple_array.hpp"
|
||||||
|
#undef private
|
||||||
|
|
||||||
|
namespace rsx
|
||||||
|
{
|
||||||
|
TEST(SimpleArray, DefaultConstructor)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr;
|
||||||
|
|
||||||
|
EXPECT_TRUE(arr.empty());
|
||||||
|
EXPECT_EQ(arr.size(), 0);
|
||||||
|
EXPECT_GE(arr.capacity(), 1u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, InitialSizeConstructor)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr(5);
|
||||||
|
|
||||||
|
EXPECT_FALSE(arr.empty());
|
||||||
|
EXPECT_EQ(arr.size(), 5);
|
||||||
|
EXPECT_GE(arr.capacity(), 5u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, InitialSizeValueConstructor)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr(3, 42);
|
||||||
|
|
||||||
|
EXPECT_EQ(arr.size(), 3);
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(arr[i], 42);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, InitializerListConstructor)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3, 4, 5 };
|
||||||
|
|
||||||
|
EXPECT_EQ(arr.size(), 5);
|
||||||
|
for (int i = 0; i < 5; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(arr[i], i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, CopyConstructor)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr1{ 1, 2, 3 };
|
||||||
|
rsx::simple_array<int> arr2(arr1);
|
||||||
|
|
||||||
|
EXPECT_EQ(arr1.size(), arr2.size());
|
||||||
|
for (u32 i = 0; i < arr1.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(arr1[i], arr2[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, MoveConstructor)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr1{ 1, 2, 3 };
|
||||||
|
u32 original_size = arr1.size();
|
||||||
|
rsx::simple_array<int> arr2(std::move(arr1));
|
||||||
|
|
||||||
|
EXPECT_EQ(arr2.size(), original_size);
|
||||||
|
EXPECT_TRUE(arr1.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, PushBackAndAccess)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr;
|
||||||
|
arr.push_back(1);
|
||||||
|
arr.push_back(2);
|
||||||
|
arr.push_back(3);
|
||||||
|
|
||||||
|
EXPECT_EQ(arr.size(), 3);
|
||||||
|
EXPECT_EQ(arr[0], 1);
|
||||||
|
EXPECT_EQ(arr[1], 2);
|
||||||
|
EXPECT_EQ(arr[2], 3);
|
||||||
|
EXPECT_EQ(arr.front(), 1);
|
||||||
|
EXPECT_EQ(arr.back(), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, PopBack)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3 };
|
||||||
|
|
||||||
|
EXPECT_EQ(arr.pop_back(), 3);
|
||||||
|
EXPECT_EQ(arr.size(), 2);
|
||||||
|
EXPECT_EQ(arr.back(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Insert)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 3, 4 };
|
||||||
|
auto it = arr.insert(arr.begin() + 1, 2);
|
||||||
|
|
||||||
|
EXPECT_EQ(*it, 2);
|
||||||
|
EXPECT_EQ(arr.size(), 4);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(arr[i], i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Clear)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3 };
|
||||||
|
arr.clear();
|
||||||
|
|
||||||
|
EXPECT_TRUE(arr.empty());
|
||||||
|
EXPECT_EQ(arr.size(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, SmallBufferOptimization)
|
||||||
|
{
|
||||||
|
// Test with a small type that should use stack storage
|
||||||
|
rsx::simple_array<char> small_arr(3, 'a');
|
||||||
|
EXPECT_TRUE(small_arr.is_local_storage());
|
||||||
|
|
||||||
|
// Test with a larger type or more elements that should use heap storage
|
||||||
|
struct LargeType { char data[128]; };
|
||||||
|
rsx::simple_array<LargeType> large_arr(10);
|
||||||
|
EXPECT_FALSE(large_arr.is_local_storage());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Iterator)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3, 4, 5 };
|
||||||
|
int sum = 0;
|
||||||
|
for (const auto& val : arr)
|
||||||
|
{
|
||||||
|
sum += val;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQ(sum, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, EraseIf)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3, 4, 5 };
|
||||||
|
bool modified = arr.erase_if([](const int& val) { return val % 2 == 0; });
|
||||||
|
arr.sort(FN(x < y));
|
||||||
|
|
||||||
|
EXPECT_TRUE(modified);
|
||||||
|
EXPECT_EQ(arr.size(), 3);
|
||||||
|
EXPECT_EQ(arr[0], 1);
|
||||||
|
EXPECT_EQ(arr[1], 3);
|
||||||
|
EXPECT_EQ(arr[2], 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Map)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3 };
|
||||||
|
auto result = arr.map([](const int& val) { return val * 2; });
|
||||||
|
|
||||||
|
EXPECT_EQ(result.size(), 3);
|
||||||
|
EXPECT_EQ(result[0], 2);
|
||||||
|
EXPECT_EQ(result[1], 4);
|
||||||
|
EXPECT_EQ(result[2], 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Reduce)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3, 4, 5 };
|
||||||
|
int sum = arr.reduce(0, [](const int& acc, const int& val) { return acc + val; });
|
||||||
|
|
||||||
|
EXPECT_EQ(sum, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Any)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 1, 2, 3, 4, 5 };
|
||||||
|
|
||||||
|
EXPECT_TRUE(arr.any([](const int& val) { return val > 3; }));
|
||||||
|
EXPECT_FALSE(arr.any([](const int& val) { return val > 5; }));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, Sort)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{ 5, 3, 1, 4, 2 };
|
||||||
|
arr.sort([](const int& a, const int& b) { return a < b; });
|
||||||
|
|
||||||
|
for (u32 i = 0; i < arr.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(arr[i], i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue