Skip to content

Commit

Permalink
Fix CI errors (#962)
Browse files Browse the repository at this point in the history
* fix distance example

* ption 'lcov_branch_coverage' is deprecated.  Consider using 'branch_coverage. instead

* stuff

* hmm i think this should do it

* format

* more format

* check initial error

* revert format stuff

* display log

* yoinks

* log

* initialise values
  • Loading branch information
JosephChotard authored Jan 19, 2025
1 parent 333c2bc commit 9a1f63b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
cd build/examples
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../../examples
make
make test
env CTEST_OUTPUT_ON_FAILURE=1 make test
clang-tests:
name: Test Compile clang ${{ matrix.build_type }} ${{ matrix.compile_opt }}
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
cd build/examples
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_FLAGS="${{ matrix.compile_opt }}" ../../examples
make
make test
env CTEST_OUTPUT_ON_FAILURE=1 make test
valgrind-tests:
name: Test Valgrind
Expand Down
2 changes: 1 addition & 1 deletion CMakeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if(ENABLE_COVERAGE)
add_custom_target(
clean-coverage
# Before running coverage, clear all counters
COMMAND lcov --rc lcov_branch_coverage=1 --directory
COMMAND lcov --rc branch_coverage=1 --directory
'${CMAKE_CURRENT_BINARY_DIR}' --zerocounters
COMMENT "Zeroing counters")
endif()
Expand Down
15 changes: 9 additions & 6 deletions examples/distance.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <assert.h>
#include <h3/h3api.h>
#include <inttypes.h>
#include <math.h>
#include <stdio.h>

Expand All @@ -49,23 +50,25 @@ double haversineDistance(double th1, double ph1, double th2, double ph2) {

int main(int argc, char *argv[]) {
// 1455 Market St @ resolution 15
H3Index h3HQ1;
H3Index h3HQ1 = 0;
stringToH3("8f2830828052d25", &h3HQ1);
// 555 Market St @ resolution 15
H3Index h3HQ2;
H3Index h3HQ2 = 0;
stringToH3("8f283082a30e623", &h3HQ2);

LatLng geoHQ1, geoHQ2;
LatLng geoHQ1 = {0};
LatLng geoHQ2 = {0};
cellToLatLng(h3HQ1, &geoHQ1);
cellToLatLng(h3HQ2, &geoHQ2);

int64_t distance;
int64_t distance = 0;
assert(gridDistance(h3HQ1, h3HQ2, &distance) == E_SUCCESS);

printf(
"origin: (%lf, %lf)\n"
"destination: (%lf, %lf)\n"
"grid distance: %d\n"
"grid distance: %" PRId64
"\n"
"distance in km: %lfkm\n",
radsToDegs(geoHQ1.lat), radsToDegs(geoHQ1.lng), radsToDegs(geoHQ2.lat),
radsToDegs(geoHQ2.lng), distance,
Expand All @@ -75,4 +78,4 @@ int main(int argc, char *argv[]) {
// destination: (37.789991, -122.402121)
// grid distance: 2340
// distance in km: 2.256853km
}
}
4 changes: 2 additions & 2 deletions scripts/coverage.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ binary_dir=${2:-"Missing binary directory"}
br_exclusion='LCOV_EXCL_BR_LINE|assert\('

cd "${binary_dir}"
lcov --rc lcov_branch_coverage=1 --rc "lcov_excl_br_line=$br_exclusion" --directory . --capture --output-file coverage.info
lcov --rc lcov_branch_coverage=1 --rc "lcov_excl_br_line=$br_exclusion" --extract coverage.info "${src_dir}/src/h3lib/*" --output-file coverage.cleaned.info
lcov --ignore-errors mismatch --rc branch_coverage=1 --rc "lcov_excl_br_line=$br_exclusion" --directory . --capture --output-file coverage.info
lcov --ignore-errors mismatch --rc branch_coverage=1 --rc "lcov_excl_br_line=$br_exclusion" --extract coverage.info "${src_dir}/src/h3lib/*" --output-file coverage.cleaned.info
genhtml --branch-coverage -o coverage coverage.cleaned.info --title 'h3 coverage'

0 comments on commit 9a1f63b

Please sign in to comment.