Skip to content

Commit eae7d20

Browse files
Removed Catch2 lib for GTest. Refactored tests to GTest. Removed destructor in Exciton/ExcitonTB classes which was causing issues with dangling pointers.
1 parent 7dbc53a commit eae7d20

8 files changed

Lines changed: 121 additions & 18086 deletions

File tree

.github/workflows/tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ jobs:
1818
run: docker build -t xatu-tests .
1919

2020
- name: Run Catch2 tests
21-
run: docker run --rm xatu-tests
21+
run: |
22+
export OMP_NUM_THREADS=1
23+
export OPENBLAS_NUM_THREADS=1
24+
docker run --rm xatu-tests

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ RUN apt-get update && apt-get install -y \
55
liblapack-dev \
66
libarmadillo-dev \
77
libarpack2-dev \
8-
gfortran && \
8+
gfortran \
9+
libgtest-dev && \
910
rm -rf /var/lib/apt/lists/*
1011

1112
WORKDIR /opt/xatu
@@ -16,4 +17,8 @@ RUN make build TEST=1
1617
WORKDIR /opt/xatu/test
1718
RUN make tests
1819

19-
CMD ["./bin/tests.x"]
20+
ENV OMP_NUM_THREADS=1
21+
ENV OPENBLAS_NUM_THREADS=1
22+
ENV OPENBLAS_CORETYPE=generic
23+
24+
CMD ["./bin/tests.x", "--gtest_color=yes"]

include/xatu/Exciton.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Exciton {
9191
public:
9292
// Constructor & Destructor
9393
Exciton(std::shared_ptr<T> sys_ptr) : system_(sys_ptr){};
94-
virtual ~Exciton(){};
94+
// virtual ~Exciton(){};
9595

9696
// Setters
9797
void setUnitCells(int);

include/xatu/ExcitonTB.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class ExcitonTB : public Exciton<SystemTB> {
9191
ExcitonTB(std::shared_ptr<SystemTB>, int ncell = 20, const arma::ivec& bands = {0, 1},
9292
const arma::rowvec& parameters = {1, 5, 1, 1, 1}, const arma::rowvec& Q = {0., 0., 0.});
9393

94-
~ExcitonTB();
94+
// ~ExcitonTB();
9595

9696
// Setters
9797
void setParameters(const arma::rowvec&);

src/ExcitonTB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ ExcitonTB::ExcitonTB(std::shared_ptr<SystemTB> sys, int ncell, int nbands, int n
228228
* Exciton destructor.
229229
* @details Used mainly for debugging; the message should be removed at some point.
230230
*/
231-
ExcitonTB::~ExcitonTB(){};
231+
// ExcitonTB::~ExcitonTB(){};
232232

233233

234234
/* ------------------------------ Setters ------------------------------ */

test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ROOT_DIR := $(shell dirname $(PWD))
1616
INCLUDE = -I$(ROOT_DIR)/include -I$(ROOT_DIR)/test
1717

1818
# Libraries
19-
LIBS = -DARMA_DONT_USE_WRAPPER -L$(ROOT_DIR) -L$(ROOT_DIR)/test -lxatu -larmadillo -lopenblas -llapack -larpack -fopenmp -lgfortran
19+
LIBS = -DARMA_DONT_USE_WRAPPER -L$(ROOT_DIR) -L$(ROOT_DIR)/test -lxatu -lgtest -larmadillo -lopenblas -llapack -larpack -fopenmp -lgfortran
2020

2121
dummy_bin_folder := $(shell mkdir -p bin)
2222

0 commit comments

Comments
 (0)