Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Aug 2022 17:53:22 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 5b8dd2d0c6fc - main - science/dimod: Fix tests
Message-ID:  <202208271753.27RHrMnS001808@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5b8dd2d0c6fcb225f099355a18e29f4736dffb57

commit 5b8dd2d0c6fcb225f099355a18e29f4736dffb57
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-08-27 17:50:29 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-08-27 17:53:10 +0000

    science/dimod: Fix tests
---
 science/dimod/Makefile                                 |  7 +++++--
 science/dimod/files/patch-testscpp_Makefile            | 18 ++++++++++++++++++
 science/dimod/files/patch-testscpp_test__main.cpp      |  9 +++++++++
 .../patch-testscpp_tests_test__quadratic__model.cpp    | 11 +++++++++++
 .../dimod/files/patch-testscpp_tests_test__utils.cpp   | 11 +++++++++++
 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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208271753.27RHrMnS001808>