From 6428710ca3b4bf933ed80a0982fb4e3f78c91185 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sat, 2 Aug 2025 19:18:35 -0700 Subject: [PATCH 1/2] CI: Check assertion output more rigorously Extend steps that run assertion failures to check not only the expected exit code, but also that the output appears to include a legible assertion message. This is intended to catch cases where the ERROR STOP character output is garbled, a defect we've now separately seen from two compilers. New CHECK_ASSERT variable factors this logic and applies it where appropriate. Force bash as the default shell, because otherwise containers default to /bin/sh --- .github/workflows/build.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7605ba0..c3b3ffa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,9 @@ jobs: build: name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }}) runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash strategy: fail-fast: false matrix: @@ -89,6 +92,7 @@ jobs: FC: ${{ matrix.compiler }} FFLAGS: ${{ matrix.extra_flags }} FPM_FLAGS: --profile release --verbose + CHECK_ASSERT: --flag -DASSERTIONS 2>&1 | tee output ; test ${PIPESTATUS[0]} = $ERROR_STOP_CODE && grep -q "Assertion failure" output steps: - name: Checkout code @@ -178,14 +182,12 @@ jobs: fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS" - name: Build and Test (Assertions ON) - env: - FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERTIONS run: | set -x - fpm test ${FPM_FLAGS} --flag "$FFLAGS" - ( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS" ; test $? = $ERROR_STOP_CODE ) - ( set +e ; fpm run --example simple-assertions ${FPM_FLAGS} --flag "$FFLAGS" ; test $? = $ERROR_STOP_CODE ) - ( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS" ; test $? = $ERROR_STOP_CODE ) + fpm test ${FPM_FLAGS} --flag "$FFLAGS" --flag -DASSERTIONS + ( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT ) + ( set +e ; eval fpm run --example simple-assertions ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT ) + ( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT ) - name: Test Assertions w/ Parallel Callbacks if: ${{ matrix.compiler != 'lfortran' }} # issue #68 @@ -195,5 +197,5 @@ jobs: set -x fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS" fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS" - ( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "$FFLAGS -DASSERTIONS" ; test $? = $ERROR_STOP_CODE ) - ( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "$FFLAGS -DASSERTIONS" ; test $? = $ERROR_STOP_CODE ) + ( set +e ; eval fpm run --example false-assertion ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT ) + ( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT ) From 39ab9dc0a0272977a0e3095d839d4aa12da68457 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 3 Aug 2025 19:09:33 -0700 Subject: [PATCH 2/2] CI: Add LFortran:latest --- .github/workflows/build.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3b3ffa..0f2524a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,12 @@ jobs: version: 0.54.0 container: phhargrove/lfortran:0.54.0-1 + # https://github.com/lfortran/lfortran/pkgs/container/lfortran + - os: ubuntu-22.04 + compiler: lfortran + version: latest + container: ghcr.io/lfortran/lfortran:latest + container: image: ${{ matrix.container }} @@ -113,7 +119,13 @@ jobs: run: | set -x apt update - apt install -y build-essential pkg-config make git curl + apt install -y build-essential # pkg-config make git curl + # Add container lfortran to PATH: + if test "$FC" = "lfortran"; then \ + echo "/app/bin" >> "$GITHUB_PATH" ; \ + ls -alh /app/bin ; \ + ls -alh /app/share/lfortran/lib/ ; \ + fi - name: Install macOS Dependencies if: contains(matrix.os, 'macos') && matrix.compiler == 'flang' @@ -166,8 +178,9 @@ jobs: - name: Version info run: | - set -x echo == TOOL VERSIONS == + echo PATH="$PATH" + set -x uname -a if test -r /etc/os-release ; then cat /etc/os-release ; fi ${FPM_FC} --version @@ -190,7 +203,7 @@ jobs: ( set +e ; eval fpm run --example invoke-via-macro ${FPM_FLAGS} --flag \"$FFLAGS\" $CHECK_ASSERT ) - name: Test Assertions w/ Parallel Callbacks - if: ${{ matrix.compiler != 'lfortran' }} # issue #68 + if: ${{ matrix.compiler != 'lfortran' || matrix.version == 'latest' }} # issue #68 env: FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERT_MULTI_IMAGE --flag -DASSERT_PARALLEL_CALLBACKS run: |