Skip to content

Commit 44cf532

Browse files
committed
add tests to CI
1 parent 835fa2f commit 44cf532

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

.github/workflows/valgrind.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,82 @@ jobs:
9292
--output-on-failure \
9393
2>&1 | tee logfile2
9494
95+
- name: Check log for Errors
96+
working-directory: ${{runner.workspace}}/build
97+
shell: bash
98+
run: |
99+
cat logfile2
100+
OUTPUT='ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)'
101+
if grep -q "$OUTPUT" logfile2; then
102+
exit 0
103+
fi
104+
exit 1
105+
106+
examples:
107+
runs-on: ${{ matrix.os }}
108+
strategy:
109+
matrix:
110+
os: [ubuntu-latest]
111+
112+
steps:
113+
- uses: actions/checkout@v4
114+
115+
- name: Install Valgrind
116+
run: sudo apt-get update && sudo apt-get install valgrind
117+
118+
- name: Create Build Environment
119+
run: cmake -E make_directory ${{runner.workspace}}/build
120+
121+
- name: Configure CMake All
122+
shell: bash
123+
working-directory: ${{runner.workspace}}/build
124+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug
125+
126+
- name: Build All
127+
working-directory: ${{runner.workspace}}/build
128+
shell: bash
129+
run: |
130+
cmake --build . --parallel
131+
132+
- name: Test cpp example
133+
working-directory: ${{runner.workspace}}/build
134+
shell: bash
135+
run: |
136+
valgrind \
137+
--leak-check=full \
138+
--show-leak-kinds=all \
139+
--track-origins=yes \
140+
-s \
141+
./bin/call_highs_from_cpp \
142+
--timeout 1000 \
143+
--output-on-failure \
144+
2>&1 | tee logfile2
145+
146+
- name: Check log for Errors
147+
working-directory: ${{runner.workspace}}/build
148+
shell: bash
149+
run: |
150+
cat logfile2
151+
OUTPUT='ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)'
152+
if grep -q "$OUTPUT" logfile2; then
153+
exit 0
154+
fi
155+
exit 1
156+
157+
- name: Test C example
158+
working-directory: ${{runner.workspace}}/build
159+
shell: bash
160+
run: |
161+
valgrind \
162+
--leak-check=full \
163+
--show-leak-kinds=all \
164+
--track-origins=yes \
165+
-s \
166+
./bin/call_highs_from_c_minimal \
167+
--timeout 1000 \
168+
--output-on-failure \
169+
2>&1 | tee logfile2
170+
95171
- name: Check log for Errors
96172
working-directory: ${{runner.workspace}}/build
97173
shell: bash

examples/call_highs_from_cpp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,7 @@ int main() {
172172
cout << endl;
173173
}
174174

175+
highs.resetGlobalScheduler(true);
176+
175177
return 0;
176178
}

highs/interfaces/highs_c_api.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ HighsInt Highs_qpCall(
173173

174174
void* Highs_create(void) { return new Highs(); }
175175

176-
void Highs_destroy(void* highs) { delete (Highs*)highs; }
176+
void Highs_destroy(void* highs) {
177+
Highs::resetGlobalScheduler(true);
178+
delete (Highs*)highs;
179+
}
177180

178181
const char* Highs_version(void) { return highsVersion(); }
179182
HighsInt Highs_versionMajor(void) { return highsVersionMajor(); }

0 commit comments

Comments
 (0)