From 6223355cf37aa7d3186b63ca2dfc3be79750db8a 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 3a5545f84..3cd66b794 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -920,16 +920,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 @@ -952,15 +956,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 @@ -983,15 +988,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 aeadbee7f..0459676ae 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} {