From c5cfa98794a712dd11103cb2e4ba26232a7f37ba Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 19 May 2025 17:41:37 +0000 Subject: [PATCH 1/2] Fix building nta tests --- libsofia-sip-ua/nta/Makefile.am | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libsofia-sip-ua/nta/Makefile.am b/libsofia-sip-ua/nta/Makefile.am index c450fd1a7..09bc981ad 100644 --- a/libsofia-sip-ua/nta/Makefile.am +++ b/libsofia-sip-ua/nta/Makefile.am @@ -23,14 +23,14 @@ AM_CPPFLAGS = -I$(srcdir)/../ipt -I../ipt \ # ---------------------------------------------------------------------- # Build targets -noinst_LTLIBRARIES = libnta.la +noinst_LTLIBRARIES = libnta.la libcombined.la check_PROGRAMS = check_nta test_nta_api test_nta portbind dist_noinst_SCRIPTS = run_test_nta_api run_test_nta TESTS = run_check_nta run_test_nta_api run_test_nta -TESTS_ENVIRONMENT = $(SHELL) +#TESTS_ENVIRONMENT = $(SHELL) # ---------------------------------------------------------------------- # Rules for building the targets @@ -49,7 +49,8 @@ libnta_la_SOURCES = nta.c nta_check.c nta_tag.c nta_tag_ref.c \ COVERAGE_INPUT = $(libnta_la_SOURCES) $(include_sofia_HEADERS) -LDADD = libnta.la \ +libcombined_la_SOURCES = +libcombined_la_LIBADD = libnta.la \ ../ipt/libipt.la \ ../sip/libsip.la \ ../features/libfeatures.la \ @@ -61,7 +62,13 @@ LDADD = libnta.la \ ../msg/libmsg.la \ ../bnf/libbnf.la \ ../su/libsu.la \ - ${top_builddir}/s2check/libs2.a -lz + ../nua/libnua.la \ + ../iptsec/libiptsec.la \ + ../nea/libnea.la \ + ../soa/libsoa.la \ + ../sdp/libsdp.la + +LDADD = libcombined.la ${top_builddir}/s2check/libs2.a -lz test_nta_LDFLAGS = -static From f561ffcf24bcbf8cf996bd693ff71e97bab79c10 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Sun, 18 May 2025 18:07:27 +0200 Subject: [PATCH 2/2] [GHA] Add `unit-test` workflow --- .drone.yml | 64 --------------- .../{build.yml => build.yml.disable} | 0 .github/workflows/unit-test.yml | 82 +++++++++++++++++++ 3 files changed, 82 insertions(+), 64 deletions(-) rename .github/workflows/{build.yml => build.yml.disable} (100%) create mode 100644 .github/workflows/unit-test.yml diff --git a/.drone.yml b/.drone.yml index 30adfcb07..128762583 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,67 +1,3 @@ ---- -kind: pipeline -name: unit-tests - -steps: - - name: bootstrap - image: signalwire/freeswitch-public-base - pull: always - commands: - - ./autogen.sh - - - name: configure - image: signalwire/freeswitch-public-base - pull: always - commands: - - apt-get -y install check - - ./configure --with-pic --without-doxygen --disable-stun - - - name: build - image: signalwire/freeswitch-public-base - pull: always - commands: - - apt-get -y install check - - echo '#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./build-status.txt\n' > build.sh - - chmod +x build.sh - - ./build.sh - - - name: run-tests - image: signalwire/freeswitch-public-base - pull: always - commands: - - apt-get -y install check - - make install - - echo '#!/bin/bash\n./tests.sh |& tee ./tests/unit/unit-tests-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./unit-tests-status.txt\n' > run-tests.sh - - chmod +x run-tests.sh - - make check && exit 0 || echo 'make check failed' - - ./run-tests.sh - - cd tests/unit - - mkdir -p logs && (mv log_run-tests_*.html logs || true) && (mv backtrace_*.txt logs || true) - - ls -la ./logs - - echo 0 > run-tests-status.txt - - ./collect-test-logs.sh && exit 0 || echo 'Some tests failed' - - ls -la - - echo 1 > run-tests-status.txt - - cd logs && ls -la - - - name: notify - image: signalwire/drone-notify - pull: always - environment: - SLACK_WEBHOOK_URL: - from_secret: slack_webhook_url - ENV_FILE: - from_secret: notify_env - commands: - - /root/unit-tests-notify.sh - -trigger: - branch: - - master - event: - - pull_request - - push - --- kind: pipeline name: scan-build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml.disable similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/build.yml.disable diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 000000000..a55846258 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,82 @@ +name: Unit tests + +on: + pull_request: + push: + branches: + - master + paths: + - "**" + +jobs: + unit-test: + runs-on: ubuntu-latest + container: + image: signalwire/freeswitch-public-ci-base:bookworm-amd64 + options: --privileged + env: + DEBIAN_FRONTEND: noninteractive + + steps: + - name: Checkout Sofia-Sip + uses: actions/checkout@v4 + + - name: Install dependencies + shell: bash + run: | + rm -vf /etc/apt/sources.list.d/freeswitch.list + apt-get update && apt-get -y install check + + - name: Configure, Build and Install Sofia-Sip + shell: bash + run: | + ./autogen.sh || exit 1 + ./configure --with-pic --without-doxygen --disable-stun || exit 1 + make -j$(nproc --all) install || exit 1 + + - name: Run Unit-Test + shell: bash + run: | + make check + + if find ./ -name "*.trs" | xargs grep FAIL -l | grep -q .; then + exit 1 + fi + + - name: Collect Unit-Test logs + if: failure() + shell: bash + run: | + find ./ -name "*.trs" | xargs grep FAIL -l | while read test; do + dir=$(dirname "$test") + file=$(basename "$test") + cat "$dir/test-suite.log" | ansi2html > "tests/unit/log_run-tests_${dir//\//!}!$file.html" + done + + cd tests/unit && mkdir -p logs + + mv -v log_run-tests_*.html logs || true + mv -v backtrace_*.txt logs || true + + ./collect-test-logs.sh || echo 'Some tests failed' + + - name: Upload Unit-Test logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: unit-test-logs + path: tests/unit/logs + if-no-files-found: ignore + compression-level: 9 + + - name: Notify run tests result to slack + if: | + failure() && + github.event_name == 'push' && + github.ref == 'refs/heads/master' + uses: signalwire/actions-template/.github/actions/slack@main + with: + CHANNEL: ${{ secrets.SLACK_DEVOPS_CI_CHANNEL }} + MESSAGE: Unit-Tests ${{ github.repository }} > <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>. Some tests are failing. + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}