Skip to content

Commit 2e64f0e

Browse files
authored
build: OSX tests (#2505)
1 parent 82b05fc commit 2e64f0e

7 files changed

Lines changed: 31 additions & 16 deletions

File tree

.github/workflows/build/osx/action.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,25 @@ runs:
181181
conan install . --deployer=direct_deploy --build=missing
182182
mkdir -p build && cd build
183183
184-
185-
cmake -G Ninja -DGUI:bool=true -DMULTI_THREADING:bool=${{ inputs.threading }} -DCONAN_GSL="OFF" -DJava_JAVA_EXECUTABLE:path=${JAVA_RUNTIME} -DANTLR_EXECUTABLE:string=$ANTLR_EXE -DQT_BASE_DIR=$QT_BASE_DIR ../ -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ inputs.osxTargetDeploymentVersion }}
184+
cmake -G Ninja -DGUI:bool=true -DMULTI_THREADING:bool=${{ inputs.threading }} -DCONAN_GSL="OFF" -DJava_JAVA_EXECUTABLE:path=${JAVA_RUNTIME} -DANTLR_EXECUTABLE:string=$ANTLR_EXE -DQT_BASE_DIR=$QT_BASE_DIR ../ -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ inputs.osxTargetDeploymentVersion }} -DBUILD_TESTS:bool=ON
186185
cmake --build . --config Release
187186
188187
# Move conan-installed deps to the build dir
189188
mv ../direct_deploy ./
190-
ls -R direct_deploy
191189
192190
# Copy over gsl libs so we can ship them with the bundle. Our exe is only linked to two of the four libs present, and this breaks the binary if we don't include them all in the package.
193191
mkdir gsl
194192
cp -v $(brew --prefix gsl)/lib/*.dylib ./gsl
195193
194+
- name: Test
195+
if: ${{ inputs.cacheOnly == 'false' }}
196+
shell: bash
197+
run: |
198+
set -ex
199+
cd build
200+
201+
ctest --output-on-failure
202+
196203
- name: Upload Raw Build Artifacts
197204
if: ${{ inputs.cacheOnly == 'false' }}
198205
uses: actions/upload-artifact@v4

conanfile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ class DissolveRecipe(ConanFile):
99
generators = "CMakeToolchain", "CMakeDeps"
1010
options = {
1111
"msvc_dev": [True, False],
12+
"tests": [True, False],
13+
"benchmarks": [True, False],
1214
}
1315
default_options = {
1416
"msvc_dev": False,
17+
"tests": True,
18+
"benchmarks": False,
1519
}
1620
def configure(self):
1721
self.options["puxixml"].header_only = False
@@ -32,8 +36,9 @@ def requirements(self):
3236
self.requires("antlr4-cppruntime/4.13.1")
3337
self.requires("gsl/2.7.1")
3438

35-
if self.settings.os == "Linux" or (self.options.msvc_dev and self.settings.build_type == "Debug"):
39+
if self.options.tests:
3640
self.requires("gtest/1.17.0")
41+
if self.options.benchmarks:
3742
self.requires("benchmark/1.8.4")
3843

3944
def build_requirements(self):

src/gui/models/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set(models_MOC_HDRS
2222
generatorModel.h
2323
generatorNodeModel.h
2424
rangeVectorModel.h
25-
renderableGroupManagerModel.h
25+
# renderableGroupManagerModel.h
2626
simpleForcefieldModel.h
2727
sitesFilterProxy.h
2828
sitesModel.h
@@ -79,7 +79,7 @@ set(models_SRCS
7979
generatorModelMimeData.h
8080
generatorNodeModel.cpp
8181
rangeVectorModel.cpp
82-
renderableGroupManagerModel.cpp
82+
# renderableGroupManagerModel.cpp
8383
simpleForcefieldModel.cpp
8484
sitesFilterProxy.cpp
8585
sitesModel.cpp

src/gui/widgets/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ add_library(
99
elementSelector.h
1010
exponentialSpin.cpp
1111
exponentialSpin.h
12-
gradientBar.cpp
13-
gradientBar.h
12+
# gradientBar.cpp
13+
# gradientBar.h
1414
integerSpin.cpp
1515
integerSpin.h
1616
noControls.cpp

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ function(dissolve_add_test)
4747
target_include_directories(${TEST_NAME} PRIVATE ${Qt6Widgets_INCLUDE_DIRS})
4848
target_link_libraries(
4949
${TEST_NAME}
50-
PUBLIC models widgets render delegates
51-
PRIVATE Qt6::Core Qt6::Widgets
50+
PUBLIC models widgets delegates gui-qml
51+
PRIVATE Qt6::Quick3D Qt6::Qml Qt6::Widgets
5252
)
5353
endif(DISSOLVE_UNIT_TEST_GUI)
5454

tests/classes/box.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ void testBasicOperations(Box &box)
6464
// Determine central coordinate from full axes matrix
6565
auto centroid = box.axes() * Vector3(0.5, 0.5, 0.5);
6666

67-
// For each corner, determine correct coordinates from full axes matrix, then test optimised imaging / vector functions
67+
// For each corner, determine correct coordinates from full axes matrix, then test optimised imaging / vector functions.
68+
// If we sit perfectly on the corner vertex we risk numerical errors breaking the tests, so step inside by a small delta.
69+
const auto delta = 1.0e-5;
6870
for (auto n = 0; n < 8; ++n)
6971
{
70-
auto corner = box.axes() * Vector3((n & 1) ? 1.0 : 0.0, (n & 2) ? 1.0 : 0.0, (n & 4) ? 1.0 : 0.0);
72+
auto corner =
73+
box.axes() * Vector3((n & 1) ? 1.0 - delta : delta, (n & 2) ? 1.0 - delta : delta, (n & 4) ? 1.0 - delta : delta);
7174

7275
// Calculate manual minimum image vector
7376
auto mimCorner = manualMim(box, corner, centroid);

tests/math/interpolator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ TEST_F(InterpolatorTest, RegularBasic)
9999
// Form interpolation of data and check interpolation at known values
100100
Interpolator I(regularData_);
101101
for (auto &&[x, y] : zip(regularData_.xAxis(), regularData_.values()))
102-
EXPECT_DOUBLE_EQ(y, I.y(x));
102+
EXPECT_NEAR(y, I.y(x), 1.0e-10);
103103

104104
auto x = 0.0;
105105
for (auto y : regularFineY_)
106106
{
107-
EXPECT_DOUBLE_EQ(y, I.y(x));
107+
EXPECT_NEAR(y, I.y(x), 1.0e-10);
108108
x += fineDeltaX;
109109
}
110110
}
@@ -127,8 +127,8 @@ TEST_F(InterpolatorTest, RegularSequentialTest)
127127
// Check against pre-calculated y values not present in the source data
128128
for (auto &&[x, y, interpy] : zip(fineBins.xAxis(), regularFineY_, fineBins.values()))
129129
{
130-
EXPECT_DOUBLE_EQ(y, I.y(x));
131-
EXPECT_DOUBLE_EQ(y, interpy);
130+
EXPECT_NEAR(y, I.y(x), 1.0e-10);
131+
EXPECT_NEAR(y, interpy, 1.0e-10);
132132
}
133133
}
134134

0 commit comments

Comments
 (0)