Skip to content

Commit

Permalink
Merge pull request #422 from SimonKagstrom/fix-freebsd-python2-tests
Browse files Browse the repository at this point in the history
CI: Fix freebsd python2 / bash tests
  • Loading branch information
SimonKagstrom authored Mar 11, 2024
2 parents 1e1002e + 436326e commit 692d41c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@ jobs:
build-freebsd:
runs-on: macos-12
runs-on: ubuntu-22.04
name: Build and test FreeBSD executable
steps:
- uses: actions/checkout@v3
- name: FreeBSD
id: test
uses: vmactions/freebsd-vm@v0
uses: vmactions/freebsd-vm@v1
with:
usesh: true
sync: rsync
prepare: pkg install -y binutils cmake elfutils python bash git
prepare: pkg install -y binutils cmake elfutils python bash git python2
run: |
chmod u+x .github/workflows/freebsd-build.sh .github/workflows/ci-run-tests.sh
.github/workflows/freebsd-build.sh x86_64
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/freebsd-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ run () {
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../tests || exit 64
make || exit 64
cd ..

chmod u+x .github/workflows/test-executable.sh
kcov --include-pattern=test-executable.sh coverage .github/workflows/test-executable.sh
cat coverage/test-executable.sh/coverage.json
}

run "$@"
1 change: 1 addition & 0 deletions src/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <getopt.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/types.h>
#include <unistd.h>
#include <map>
Expand Down
3 changes: 3 additions & 0 deletions src/engines/bash-engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class BashEngine : public ScriptEngineBase
unsigned int argc = conf.getArgc();
int xtraceFd = 782; // Typical bash users use 3,4 etc but not high fd numbers (?)
{
// This doesn't work on (recent?) FreeBSDs, so disable for now
#ifndef __FreeBSD__
// However, the range of fd numbers that this process can use is limited by the caller of this process.
// The following code specification will require discussion with many kcov users.
struct rlimit rlim;
Expand All @@ -161,6 +163,7 @@ class BashEngine : public ScriptEngineBase
return false;
}
xtraceFd = rlim.rlim_cur / 4;
#endif
}
const std::string command = conf.keyAsString("bash-command");
bool usePS4 = conf.keyAsInt("bash-use-ps4");
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ add_executable(multi_1 merge-tests/file.c merge-tests/main_1.c)
add_executable(multi_2 merge-tests/file.c merge-tests/main_2.c)

add_executable(setpgid-kill setpgid-kill/setpgid-kill-main.cc ../src/utils.cc)
target_link_libraries(setpgid-kill ${ZLIB_LIBRARIES} ${CURL_LIBRARIES})
target_link_libraries(setpgid-kill ${ZLIB_LIBRARIES} CURL::libcurl)

add_executable(issue31 daemon/test-issue31.cc)
target_link_libraries(issue31 ${CMAKE_THREAD_LIBS_INIT})
Expand Down

0 comments on commit 692d41c

Please sign in to comment.