From ef2e62cb5a7ee1755b6a73f4c3a34f45a3c498e3 Mon Sep 17 00:00:00 2001 From: Sanjula Ganepola <32170854+SanjulaGanepola@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:33:42 -0400 Subject: [PATCH 1/2] Fix SRCSTMF to use absolute paths to debug program (#137) Signed-off-by: Sanjula Ganepola --- ile/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ile/Makefile b/ile/Makefile index 3f4e780..b2d12ae 100644 --- a/ile/Makefile +++ b/ile/Makefile @@ -25,10 +25,10 @@ src/mzversion.h: system "CRTPGM PGM(${BUILDLIB}/$*) MODULE($(patsubst %.module,$(BUILDLIB)/%,$(notdir $^))) ACTGRP(*CALLER)" /qsys.lib/${BUILDLIB}.lib/%.module: src/%.cpp src/mzversion.h - system "CRTCPPMOD MODULE(${BUILDLIB}/$*) SRCSTMF('$<') OPTION(*EVENTF) SYSIFCOPT(*IFS64IO) DBGVIEW(*SOURCE) TERASPACE(*YES *TSIFC) STGMDL(*SNGLVL) DTAMDL(*p128) DEFINE(DEBUG_ENABLED)" + system "CRTCPPMOD MODULE(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$<') OPTION(*EVENTF) SYSIFCOPT(*IFS64IO) DBGVIEW(*SOURCE) TERASPACE(*YES *TSIFC) STGMDL(*SNGLVL) DTAMDL(*p128) DEFINE(DEBUG_ENABLED)" /qsys.lib/${BUILDLIB}.lib/%.module: src/%.sqlc - system "CRTSQLCI OBJ(${BUILDLIB}/$*) SRCSTMF('$^') COMMIT(*NONE) DATFMT(*ISO) TIMFMT(*ISO) CVTCCSID(*JOB) COMPILEOPT('INCDIR(''src'')') SQLPATH(${BUILDLIB}) DFTRDBCOL(${BUILDLIB}) OPTION(*SQL)" + system "CRTSQLCI OBJ(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$^') COMMIT(*NONE) DATFMT(*ISO) TIMFMT(*ISO) DBGVIEW(*SOURCE) CVTCCSID(*JOB) COMPILEOPT('INCDIR(''src'')') SQLPATH(${BUILDLIB}) DFTRDBCOL(${BUILDLIB}) OPTION(*SQL)" /qsys.lib/${BUILDLIB.lib}: -system "RUNSQL SQL('create schema ${BUILDLIB}') NAMING(*SYS)" @@ -42,7 +42,7 @@ src/mzversion.h: system -kKv "CRTMSGQ MSGQ(${BUILDLIB}/$*) TEXT('Testing queue') CCSID(1208)" /qsys.lib/${BUILDLIB}.lib/%.file: install_tasks/%.sql - system -kKv "RUNSQLSTM SRCSTMF('$<') COMMIT(*NONE) DFTRDBCOL(${BUILDLIB})" + system -kKv "RUNSQLSTM SRCSTMF('$(CURDIR)/$<') COMMIT(*NONE) DFTRDBCOL(${BUILDLIB})" echo "Success" uninstall: From 0eb28077b4a784d1a1a2a3f9491cc7406db5d133 Mon Sep 17 00:00:00 2001 From: Jonathan <42983653+jonnyz32@users.noreply.github.com> Date: Wed, 31 Jul 2024 09:26:51 -0400 Subject: [PATCH 2/2] Add test github action; clean up github workflows (#135) Co-authored-by: Jonathan Zak --- .github/workflows/build_release.yml | 8 ++- .github/workflows/ibmi.yml | 62 ----------------------- .github/workflows/test.yml | 76 +++++++++++++++++++++++++++++ Makefile | 18 +++---- config/Makefile | 2 +- ile/Makefile | 2 +- test/Makefile | 4 +- test/msg/snd2q/Makefile | 2 + test/runTests.sh | 14 +++++- 9 files changed, 106 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/ibmi.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index aee1278..c7e2045 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -10,8 +10,7 @@ on: env: remote_build_dir: /home/${{ secrets.IBMI_USER }}/build/${{ github.sha }}/ jar_file: manzan-installer-${{ github.ref_name }}.jar - build_lib: MANZANBLD - dist_lib: MANZAN + BUILDLIB: MANZAN jobs: build: @@ -63,9 +62,8 @@ jobs: run: | ici \ --rcwd "${{ env.remote_build_dir }}" \ - --ignore --cl "dltlib ${{ env.build_lib }}" \ - --ignore --cl "dltlib ${{ env.dist_lib }}" \ - --ignore --cmd "rm -fr ${{ env.remote_build_dir }} /QOpenSys/etc/manzan /opt/manzan" + --cmd "/QOpenSys/pkgs/bin/gmake BUILDLIB=${{ env.BUILDLIB }} uninstall" + --ignore --cmd "rm -fr ${{ env.remote_build_dir }}" env: IBMI_HOST: ${{ secrets.IBMI_HOST }} IBMI_USER: ${{ secrets.IBMI_USER }} diff --git a/.github/workflows/ibmi.yml b/.github/workflows/ibmi.yml deleted file mode 100644 index 2ffdb45..0000000 --- a/.github/workflows/ibmi.yml +++ /dev/null @@ -1,62 +0,0 @@ -# This workflow will build the ILE component. -# It can be triggered by making changes in the ile directory and either pushing or creating a pull request into main. - -name: IBM i build CI - -on: - push: - branches: [ "main" ] - paths: - - 'ile/**' - pull_request: - branches: [ "main" ] - paths: - - 'ile/**' - -env: - remote_build_dir: /home/${{ secrets.IBMI_USER }}/build/${{ github.sha }} - ci_build_lib: MZNCI - -jobs: - build: - runs-on: ubuntu-latest - - environment: OSSBUILD - - strategy: - matrix: - node-version: [20.x] - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - always-auth: true - - - name: Install NPM Dependencies - run: npm i -g @ibm/ibmi-ci - - - name: Get short SHA ID - run: | - echo "short_sha=$(echo ${{ github.sha }} | head -c 5)" >> $GITHUB_ENV - cat $GITHUB_ENV - - - name: Deploy to IBM i - run: | - ici \ - --rcwd "${{ env.remote_build_dir }}" \ - --push "." \ - --cmd "/QOpenSys/pkgs/bin/gmake -C ile BUILDLIB=${{ env.ci_build_lib }}$short_sha uninstall all" \ - --ignore --cl "dltlib ${{ env.ci_build_lib }}$short_sha" \ - --rcwd ".." \ - --ignore --cmd "rm -fr ${{ env.remote_build_dir }}" - env: - IBMI_HOST: ${{ secrets.IBMI_HOST }} - IBMI_USER: ${{ secrets.IBMI_USER }} - IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }} - IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f7e657a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,76 @@ +# This workflow will test Manzan + +name: Test Manzan + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "*" ] + +env: + remote_build_dir: /home/${{ secrets.IBMI_USER }}/testbuild/ + BUILDLIB: MZNTEST + +jobs: + test: + runs-on: ubuntu-latest + + environment: OSSBUILD + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: 'https://registry.npmjs.org' + always-auth: true + + - name: Install NPM Dependencies + run: npm i -g @ibm/ibmi-ci + + - name: Install Manzan + run: | + ici \ + --rcwd "${{ env.remote_build_dir }}" \ + --push "." \ + --cmd "/QOpenSys/pkgs/bin/gmake BUILDLIB=${{ env.BUILDLIB }} install" \ + env: + IBMI_HOST: ${{ secrets.IBMI_HOST }} + IBMI_USER: ${{ secrets.IBMI_USER }} + IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }} + IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }} + BUILDLIB: MZNTEST + + - name: Test Manzan + working-directory: test + run: | + ici \ + --rcwd "${{ env.remote_build_dir }}" \ + --cmd "/QOpenSys/pkgs/bin/gmake testonly;" \ + env: + IBMI_HOST: ${{ secrets.IBMI_HOST }} + IBMI_USER: ${{ secrets.IBMI_USER }} + IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }} + IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }} + + - name: Cleanup + if: always() + run: | + ici \ + --rcwd "${{ env.remote_build_dir }}" \ + --cmd "/QOpenSys/pkgs/bin/gmake BUILDLIB=${{ env.BUILDLIB }} uninstall" \ + env: + IBMI_HOST: ${{ secrets.IBMI_HOST }} + IBMI_USER: ${{ secrets.IBMI_USER }} + IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }} + IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }} diff --git a/Makefile b/Makefile index 954b903..c4268ed 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ -BUILDLIB:=MANZAN -MANZAN_TEMPLIB:=MANZANBLD +BUILDLIB?=MANZAN BUILDVERSION:="Development build \(built with Make\)" .PHONY: ile camel test ile: - gmake -C ile + gmake -C ile BUILDLIB=${BUILDLIB} camel: gmake -C camel @@ -19,13 +18,13 @@ testonly: all: ile camel install: - gmake -C config install - gmake -C ile + gmake -C config install BUILDLIB=${BUILDLIB} + gmake -C ile BUILDLIB=${BUILDLIB} gmake -C camel install uninstall: - gmake -C ile uninstall - gmake -C config uninstall + gmake -C ile uninstall BUILDLIB=${BUILDLIB} + gmake -C config uninstall BUILDLIB=${BUILDLIB} /QOpenSys/pkgs/bin/zip: /QOpenSys/pkgs/bin/yum install zip @@ -38,12 +37,11 @@ appinstall.jar: /QOpenSys/pkgs/bin/wget manzan-installer-v%.jar: /QOpenSys/pkgs/bin/zip appinstall.jar echo "Building version $*" - system "clrlib ${MANZAN_TEMPLIB}" || system "crtlib ${MANZAN_TEMPLIB}" system "dltlib ${BUILDLIB}" || echo "could not delete" system "crtlib ${BUILDLIB}" system "dltlib ${BUILDLIB}" rm -fr /QOpenSys/etc/manzan - gmake -C config BUILDVERSION="$*" install - gmake -C ile BUILDVERSION="$*" + gmake -C config BUILDVERSION="$*" install BUILDLIB=${BUILDLIB} + gmake -C ile BUILDVERSION="$*" BUILDLIB=${BUILDLIB} gmake -C camel BUILDVERSION="$*" clean install /QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -jar appinstall.jar --qsys manzan --dir /QOpenSys/etc/manzan --file /opt/manzan -o $@ diff --git a/config/Makefile b/config/Makefile index fea954c..76958da 100755 --- a/config/Makefile +++ b/config/Makefile @@ -1,5 +1,5 @@ -BUILDLIB:=MANZAN +BUILDLIB?=MANZAN .PHONY: mkdirs app.ini diff --git a/ile/Makefile b/ile/Makefile index b2d12ae..13d9822 100644 --- a/ile/Makefile +++ b/ile/Makefile @@ -1,4 +1,4 @@ -BUILDLIB:=MANZAN +BUILDLIB?=MANZAN BUILDVERSION:="Development build \(built with Make\)" all: init /qsys.lib/${BUILDLIB}.lib/handler.pgm diff --git a/test/Makefile b/test/Makefile index 7e93cc6..46d3b1a 100755 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ -.PHONY: ile testing +.PHONY: ile testing runtests ile: gmake -C ../ile @@ -21,7 +21,7 @@ posttest: runtests: echo "Running tests" - exec runTests.sh + ./runTests.sh testing: /qsys.lib/${BUILDLIB}.lib/MANZANQ.msgq watch_start watch_testq watch_end diff --git a/test/msg/snd2q/Makefile b/test/msg/snd2q/Makefile index 9f65da2..6d2a8ef 100644 --- a/test/msg/snd2q/Makefile +++ b/test/msg/snd2q/Makefile @@ -26,4 +26,6 @@ run: sleep 5 checkresult: + echo "contents of file" + cat $(CURDIR)/test.out grep -i CAE0023 $(CURDIR)/test.out diff --git a/test/runTests.sh b/test/runTests.sh index 1138925..7bf3a97 100644 --- a/test/runTests.sh +++ b/test/runTests.sh @@ -22,7 +22,11 @@ do echo "Done running test $test. Exit code was $?" echo "Killing jobs..." - for pid in $(ps | grep jre| awk '{print $1}') + echo "Printing processes" + + # Get user string only up to 8th character since it gets truncated in process table + ps -ef | grep jre | grep "${USER:0:8}" + for pid in $(ps -ef | grep jre | grep "${USER:0:8}" | awk '{print $2}') do echo killing pid $pid kill -INT $pid @@ -56,3 +60,11 @@ do echo " $num_fail failed" echo " $num_error errored" done + +if [ $num_fail -ne 0 ] || [ $num_error -ne 0 ]; then + echo "Tests failed." + exit 1 +else + echo "All tests passed." + exit 0 +fi