summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2022-08-27 10:50:29 -0700
committerYuri Victorovich <yuri@FreeBSD.org>2022-08-27 10:53:10 -0700
commit5b8dd2d0c6fcb225f099355a18e29f4736dffb57 (patch)
tree4489cd72707d01c0eeb3d7a53b067ab9bbd15a80
parentnet/libfabric: Revert commit "Broken on riscv64" (diff)
science/dimod: Fix tests
-rw-r--r--science/dimod/Makefile7
-rw-r--r--science/dimod/files/patch-testscpp_Makefile18
-rw-r--r--science/dimod/files/patch-testscpp_test__main.cpp9
-rw-r--r--science/dimod/files/patch-testscpp_tests_test__quadratic__model.cpp11
-rw-r--r--science/dimod/files/patch-testscpp_tests_test__utils.cpp11
5 files changed, 54 insertions, 2 deletions
diff --git a/science/dimod/Makefile b/science/dimod/Makefile
index 4d59970402e3..21da4eff0726 100644
--- a/science/dimod/Makefile
+++ b/science/dimod/Makefile
@@ -8,9 +8,12 @@ COMMENT= DWave: Shared API for QUBO/Ising samplers
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
+TEST_DEPENDS= catch>0:devel/catch
+
+USES= compiler:c++11-lang pkgconfig
+
USE_GITHUB= yes
GH_ACCOUNT= dwavesystems
-GH_TUPLE= catchorg:Catch2:f0dc4d9:catch/testscpp/Catch2
NO_BUILD= yes
NO_ARCH= yes
@@ -26,7 +29,7 @@ do-install:
cd ${WRKSRC}/dimod/include && \
${COPYTREE_SHARE} dimod ${STAGEDIR}${PREFIX}/include
-do-test: # tests fail to compile, see https://github.com/dwavesystems/dimod/issues/1238
+do-test:
@cd ${WRKSRC}/testscpp && ${SETENV} ${MAKE_ENV} ${MAKE}
.include <bsd.port.mk>
diff --git a/science/dimod/files/patch-testscpp_Makefile b/science/dimod/files/patch-testscpp_Makefile
new file mode 100644
index 000000000000..f0f295b10761
--- /dev/null
+++ b/science/dimod/files/patch-testscpp_Makefile
@@ -0,0 +1,18 @@
+--- testscpp/Makefile.orig 2022-08-16 14:45:27 UTC
++++ testscpp/Makefile
+@@ -13,12 +13,12 @@ coverage:
+ rm baseline.info test.info
+ lcov --remove coverage.info '/usr/*' --output-file coverage.info
+
+-tests: test_main.out
++tests: test_main
+ ./test_main
+
+ test_main: test_main.cpp
+- g++ -std=c++11 -Wall -Werror -c test_main.cpp
+- g++ -std=c++11 -Wall -Werror test_main.o tests/*.cpp -o test_main -I $(SRC)
++ g++ $(CXXFLAGS) `pkg-config --cflags catch2` -std=c++11 -Wall -c test_main.cpp
++ g++ $(CXXFLAGS) `pkg-config --cflags --libs catch2` -std=c++11 -Wall test_main.o tests/*.cpp -o test_main -I $(SRC)
+
+ catch2:
+ git submodule init
diff --git a/science/dimod/files/patch-testscpp_test__main.cpp b/science/dimod/files/patch-testscpp_test__main.cpp
new file mode 100644
index 000000000000..bb485e158894
--- /dev/null
+++ b/science/dimod/files/patch-testscpp_test__main.cpp
@@ -0,0 +1,9 @@
+--- testscpp/test_main.cpp.orig 2022-08-27 15:45:50 UTC
++++ testscpp/test_main.cpp
+@@ -1,5 +1,5 @@
+ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
+-#include "Catch2/single_include/catch2/catch.hpp"
++#include <catch2/catch.hpp>
+
+ /*
+ The purpose of this file is to include Catch's main(). Tests can be found inside tests directory.
diff --git a/science/dimod/files/patch-testscpp_tests_test__quadratic__model.cpp b/science/dimod/files/patch-testscpp_tests_test__quadratic__model.cpp
new file mode 100644
index 000000000000..b29152b9e491
--- /dev/null
+++ b/science/dimod/files/patch-testscpp_tests_test__quadratic__model.cpp
@@ -0,0 +1,11 @@
+--- testscpp/tests/test_quadratic_model.cpp.orig 2022-08-27 15:54:59 UTC
++++ testscpp/tests/test_quadratic_model.cpp
+@@ -14,7 +14,7 @@
+
+ #include <iostream>
+
+-#include "../Catch2/single_include/catch2/catch.hpp"
++#include <catch2/catch.hpp>
+ #include "dimod/quadratic_model.h"
+
+ namespace dimod {
diff --git a/science/dimod/files/patch-testscpp_tests_test__utils.cpp b/science/dimod/files/patch-testscpp_tests_test__utils.cpp
new file mode 100644
index 000000000000..6283681a7a6b
--- /dev/null
+++ b/science/dimod/files/patch-testscpp_tests_test__utils.cpp
@@ -0,0 +1,11 @@
+--- testscpp/tests/test_utils.cpp.orig 2022-08-27 15:49:35 UTC
++++ testscpp/tests/test_utils.cpp
+@@ -15,7 +15,7 @@
+ #include <iostream>
+ #include <random>
+
+-#include "../Catch2/single_include/catch2/catch.hpp"
++#include <catch2/catch.hpp>
+ #include "dimod/utils.h"
+
+ namespace dimod {