From: Terry Burton Date: Mon, 9 Aug 2021 22:59:18 +0000 (+0100) Subject: FreeBSD fixes and CI (#4177) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56543b49e52cda6a4a52f7f5b7d287d3814101ec;p=thirdparty%2Ffreeradius-server.git FreeBSD fixes and CI (#4177) --- diff --git a/.github/workflows/ci-freebsd.yml b/.github/workflows/ci-freebsd.yml index b0e66fbe5e6..251d630dfd6 100644 --- a/.github/workflows/ci-freebsd.yml +++ b/.github/workflows/ci-freebsd.yml @@ -3,7 +3,7 @@ name: CI FreeBSD on: push: branches: - - packaging_test + - ci-debug schedule: - cron: '0 20 * * *' @@ -39,9 +39,10 @@ jobs: working-directory: freeradius - name: Test using a FreeBSD VirtualBox VM - uses: vmactions/freebsd-vm@v0.0.9 + uses: vmactions/freebsd-vm@v0.1.5 with: usesh: true + sync: sshfs prepare: | pkg install -y \ curl \ @@ -63,7 +64,7 @@ jobs: net-snmp \ openldap-client \ python3 \ - py37-pip \ + py38-pip \ postgresql12-client \ talloc \ unixODBC @@ -81,3 +82,38 @@ jobs: echo 'test.digest:' > src/tests/digest/all.mk echo 'test.radmin:' > src/tests/radmin/all.mk gmake test + + # + # If the CI has failed and the branch is ci-debug then we start a tmate + # session to provide interactive shell access to the session. + # + # The SSH rendezvous point will be emited continuously in the job output, + # which will look something like: + # + # SSH: ssh VfuX8SrNuU5pGPMyZcz7TpJTa@sfo2.tmate.io + # + # For example: + # + # git push origin ci-debug --force + # + # Look at the job output in: https://github.com/FreeRADIUS/freeradius-server/actions + # + # ssh VfuX8SrNuU5pGPMyZcz7TpJTa@sfo2.tmate.io + # + # Access requires that you have the private key corresponding to the + # public key of the GitHub user that initiated the job. + # + # The above will open a shell for the MacOS environment on which the + # FreeBSD VM is running within VirtualBox. + # + # Access the FreeBSD VM with: + # + # ssh -t freebsd + # + - name: "Debug: Start tmate" + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + repo-token: ${{ secrets.GITHUB_TOKEN }} + if: ${{ github.ref == 'refs/heads/ci-debug' && failure() }} + diff --git a/src/lib/util/debug.c b/src/lib/util/debug.c index ea7061560de..67eda5cff20 100644 --- a/src/lib/util/debug.c +++ b/src/lib/util/debug.c @@ -274,13 +274,13 @@ int fr_get_lsan_state(void) #endif #if defined(HAVE_SYS_PROCCTL_H) -static int fr_get_debug_state(void) +int fr_get_debug_state(void) { int status; if (procctl(P_PID, getpid(), PROC_TRACE_STATUS, &status) == -1) { fr_strerror_printf("Cannot get dumpable flag: procctl(PROC_TRACE_STATUS) failed: %s", fr_syserror(errno)); - return DEBUG_STATE_UNKNOWN; + return DEBUGGER_STATE_UNKNOWN; } /* @@ -292,9 +292,9 @@ static int fr_get_debug_state(void) * the ptrace(2) syscall, data is set to 0. If a debugger is attached, * data is set to the pid of the debugger process. */ - if (status <= 0) return DEBUG_STATE_NOT_ATTACHED; + if (status <= 0) return DEBUGGER_STATE_NOT_ATTACHED; - return DEBUG_STATE_ATTACHED; + return DEBUGGER_STATE_ATTACHED; } #elif defined(__APPLE__) /** The ptrace_attach() method no longer works as of macOS 11.4 (we always get eperm)