From ffde2cf74dc7af59ed8ba38fdfe7ed7727ead220 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Mon, 6 Nov 2023 18:07:14 +0200 Subject: [PATCH] Use cross-platform-actions for FreeBSD support. (#12732) This change overcomes many stability issues experienced with the vmactions action. We need to limit VMs to 8GB for better stability, as the 13GB default seems to hang them occasionally. Shell code has been simplified since this action seem to use `bash -e` which will abort on non-zero exit codes anyway. --- .github/workflows/daily.yml | 56 ++++++++++++++++++++----------------- tests/unit/info.tcl | 14 +++++++--- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 72720e6dd..78268b653 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -891,16 +891,20 @@ jobs: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} - name: test - uses: vmactions/freebsd-vm@v0.3.1 + uses: cross-platform-actions/action@v0.21.1 + env: + MAKE: gmake with: - usesh: true - sync: rsync - copyback: false - prepare: pkg install -y bash gmake lang/tcl86 lang/tclx - run: > - gmake || exit 1 ; - if echo "${{github.event.inputs.skiptests}}" | grep -vq redis ; then ./runtest --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} || exit 1 ; fi ; - if echo "${{github.event.inputs.skiptests}}" | grep -vq modules ; then MAKE=gmake ./runtest-moduleapi --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} || exit 1 ; fi ; + operating_system: freebsd + environment_variables: MAKE + version: 13.2 + memory: 8GB + shell: bash + run: | + sudo pkg install -y bash gmake lang/tcl86 lang/tclx + gmake + if echo "${{github.event.inputs.skiptests}}" | grep -vq redis ; then ./runtest --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} ; fi + if echo "${{github.event.inputs.skiptests}}" | grep -vq modules ; then ./runtest-moduleapi --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} ; fi test-freebsd-sentinel: runs-on: macos-12 @@ -923,15 +927,16 @@ jobs: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} - name: test - uses: vmactions/freebsd-vm@v0.3.1 + uses: cross-platform-actions/action@v0.21.1 with: - usesh: true - sync: rsync - copyback: false - prepare: pkg install -y bash gmake lang/tcl86 lang/tclx - run: > - gmake || exit 1 ; - if echo "${{github.event.inputs.skiptests}}" | grep -vq sentinel ; then ./runtest-sentinel ${{github.event.inputs.cluster_test_args}} || exit 1 ; fi ; + operating_system: freebsd + version: 13.2 + memory: 8GB + shell: bash + run: | + sudo pkg install -y bash gmake lang/tcl86 lang/tclx + gmake + if echo "${{github.event.inputs.skiptests}}" | grep -vq sentinel ; then ./runtest-sentinel ${{github.event.inputs.cluster_test_args}} ; fi test-freebsd-cluster: runs-on: macos-12 @@ -954,15 +959,16 @@ jobs: repository: ${{ env.GITHUB_REPOSITORY }} ref: ${{ env.GITHUB_HEAD_REF }} - name: test - uses: vmactions/freebsd-vm@v0.3.1 + uses: cross-platform-actions/action@v0.21.1 with: - usesh: true - sync: rsync - copyback: false - prepare: pkg install -y bash gmake lang/tcl86 lang/tclx - run: > - gmake || exit 1 ; - if echo "${{github.event.inputs.skiptests}}" | grep -vq cluster ; then ./runtest-cluster ${{github.event.inputs.cluster_test_args}} || exit 1 ; fi ; + operating_system: freebsd + version: 13.2 + memory: 8GB + shell: bash + run: | + sudo pkg install -y bash gmake lang/tcl86 lang/tclx + gmake + if echo "${{github.event.inputs.skiptests}}" | grep -vq cluster ; then ./runtest-cluster ${{github.event.inputs.cluster_test_args}} ; fi test-alpine-jemalloc: runs-on: ubuntu-latest diff --git a/tests/unit/info.tcl b/tests/unit/info.tcl index 812704340..675e9ca17 100644 --- a/tests/unit/info.tcl +++ b/tests/unit/info.tcl @@ -300,15 +300,21 @@ start_server {tags {"info" "external:skip"}} { test {stats: instantaneous metrics} { r config resetstat - after 1600 ;# hz is 10, wait for 16 cron tick so that sample array is fulfilled - set value [s instantaneous_eventloop_cycles_per_sec] + set retries 0 + for {set retries 1} {$retries < 4} {incr retries} { + after 1600 ;# hz is 10, wait for 16 cron tick so that sample array is fulfilled + set value [s instantaneous_eventloop_cycles_per_sec] + if {$value > 0} break + } + + assert_lessthan $retries 4 if {$::verbose} { puts "instantaneous metrics instantaneous_eventloop_cycles_per_sec: $value" } assert_morethan $value 0 - assert_lessthan $value 15 ;# default hz is 10 + assert_lessthan $value [expr $retries*15] ;# default hz is 10 set value [s instantaneous_eventloop_duration_usec] if {$::verbose} { puts "instantaneous metrics instantaneous_eventloop_duration_usec: $value" } assert_morethan $value 0 - assert_lessthan $value 22000 ;# default hz is 10, so duration < 1000 / 10, allow some tolerance + assert_lessthan $value [expr $retries*22000] ;# default hz is 10, so duration < 1000 / 10, allow some tolerance } test {stats: debug metrics} {