From 007548e6da61e6982433060c4c92edd1c65f25dd Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 7 May 2026 10:58:55 -0400 Subject: [PATCH 1/4] Fix #998, update workflow configuration Updates the configuration and workflows to address failures --- .github/workflows/codeql-analysis.yml | 15 +- .github/workflows/codeql-reusable.yml | 6 +- .github/workflows/test-cfs-qemu.yml | 135 ++++++++++++++---- .gitignore | 2 +- actions/build-app/action.yml | 62 ++++++++ actions/healthcheck-logs/action.yml | 2 +- actions/setup-app/action.yml | 56 ++++++-- custom-rules.mk | 45 +++--- sample_defs/generate_startup.cmake | 2 - .../toolchain-mips32r2-poky-linux.cmake | 2 +- .../toolchain-riscv64-poky-linux.cmake | 2 +- 11 files changed, 250 insertions(+), 79 deletions(-) create mode 100644 actions/build-app/action.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6da445937..7a12e5793 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,22 +1,15 @@ name: "CodeQL Analysis: cFS-Bundle" +# There are still some bugs with this workflow, so keeping +# it as manual dispatch for now until they can be fixed. on: - push: - branches: - - dev - - main - pull_request: - types: - - opened - - reopened - - synchronize workflow_dispatch: jobs: codeql: - uses: nasa/cFS/.github/workflows/codeql-reusable.yml@dev + uses: ./.github/workflows/codeql-reusable.yml with: component-path: cFS prep: make native_std.prep make: make native_std.install - test: true \ No newline at end of file + test: true diff --git a/.github/workflows/codeql-reusable.yml b/.github/workflows/codeql-reusable.yml index 0df9dfde8..c2a6bdb54 100644 --- a/.github/workflows/codeql-reusable.yml +++ b/.github/workflows/codeql-reusable.yml @@ -30,20 +30,20 @@ on: prep: description: 'Make Prep' - default: make prep + default: 'make native_std.prep' required: false type: string setup: description: 'Build Prep Commands' type: string - default: cp ./cfe/cmake/Makefile.sample Makefile && cp -r ./cfe/cmake/sample_defs sample_defs + default: '' required: false test: description: 'Value for ENABLE_UNIT_TESTS flag' type: string - default: false + default: 'false' required: false # Force bash to apply pipefail option so pipeline failures aren't masked diff --git a/.github/workflows/test-cfs-qemu.yml b/.github/workflows/test-cfs-qemu.yml index cb1a1d332..ffd613efb 100644 --- a/.github/workflows/test-cfs-qemu.yml +++ b/.github/workflows/test-cfs-qemu.yml @@ -91,8 +91,8 @@ jobs: strategy: matrix: include: - # - config: qemu_yocto_linux - # build-image: 'ghcr.io/core-flight-system/cfsbuildenv-yocto:latest' + - config: qemu_yocto_linux + build-image: 'ghcr.io/core-flight-system/cfsbuildenv-yocto:latest' - config: native_std build-image: 'ghcr.io/core-flight-system/cfsbuildenv-linux:latest' - config: native_eds @@ -104,7 +104,7 @@ jobs: - config: gr712_rtems5 build-image: 'ghcr.io/core-flight-system/cfsbuildenv-gaisler-sparc-rcc:latest' name: Build CFS with ${{ matrix.config }} configuration - uses: nasa/cFS/.github/workflows/build-cfs-multitarget.yml@dev + uses: ./.github/workflows/build-cfs-multitarget.yml with: config-name: ${{ matrix.config }} container-image: ${{ matrix.build-image }} @@ -128,24 +128,19 @@ jobs: include: - config: native_std healthcheck-regex: 'CFE_ES_Main entering OPERATIONAL state$' - exec-image: ghcr.io/core-flight-system/cfsbuildenv-linux:latest - cpu1-test-procedure: trad_le - cpu2-test-procedure: trad_le + exec-image: ghcr.io/core-flight-system/cfsexec-linux:latest + test-procedure: 'trad_le' + log-fetch-method: 'direct' - config: native_eds healthcheck-regex: 'CFE_ES_Main entering OPERATIONAL state$' - exec-image: ghcr.io/core-flight-system/cfsbuildenv-linux:latest - cpu1-test-procedure: eds - cpu2-test-procedure: eds - # - config: qemu_yocto_linux - # healthcheck-regex: '^Poky (Yocto Project Reference Distro)' - # exec-image: ghcr.io/core-flight-system/cfsexec-qemu:latest - # cpu1-test-procedure: trad_le - # cpu2-test-procedure: trad_be + exec-image: ghcr.io/core-flight-system/cfsexec-linux:latest + test-procedure: 'eds' + log-fetch-method: 'direct' - config: pc686_rtems5 healthcheck-regex: 'CFE_ES_Main entering OPERATIONAL state' exec-image: ghcr.io/core-flight-system/cfsexec-qemu:latest - cpu1-test-procedure: trad_le - cpu2-test-procedure: trad_le + test-procedure: 'trad_le' + log-fetch-method: 'direct' steps: - name: Download artifact from build @@ -188,23 +183,111 @@ jobs: container-id: ${{ steps.start-cpu1.outputs.container-id }} healthcheck-regex: ${{ matrix.healthcheck-regex }} - - name: Execute cpu1 test (traditional little endian) - if: matrix.cpu1-test-procedure == 'trad_le' + - name: Setup log retrieval via SSH + if: matrix.log-fetch-method == 'ssh' + shell: bash run: | - ./host/cmd_send --host=${{ steps.check-cpu1.outputs.ip-addr }} --endian=LE --pktid=0x1806 --cmdcode=0 + mkdir -p ~/.ssh + chmod 0700 ~/.ssh + touch ~/.ssh/known_hosts + chmod 0600 ~/.ssh/known_hosts + ssh-keyscan -p 2222 ${{ steps.check-cpu1.outputs.ip-addr }} >> ~/.ssh/known_hosts + cat ~/.ssh/known_hosts + cat > ./fetch_logs.sh << EOF + #!/bin/bash + ssh -p 2222 root@${{ steps.check-cpu1.outputs.ip-addr }} grep 'user\.notice CFS:' /var/log/messages | sed -e 's/^.*user\.notice CFS: //' + EOF + chmod +x ./fetch_logs.sh + cat ./fetch_logs.sh - - name: Execute cpu1 test (traditional big endian) - if: matrix.cpu1-test-procedure == 'trad_be' + - name: Setup direct log retrieval + if: matrix.log-fetch-method == 'direct' + shell: bash run: | - ./host/cmd_send --host=${{ steps.check-cpu1.outputs.ip-addr }} --endian=BE --pktid=0x1806 --cmdcode=0 + cat > ./fetch_logs.sh << EOF + #!/bin/bash + docker logs "${{ steps.start-cpu1.outputs.container-id }}" + EOF + chmod +x ./fetch_logs.sh + cat ./fetch_logs.sh - - name: Execute test procedure (EDS) - if: matrix.cpu1-test-procedure == 'eds' + - name: Setup Environment + if: matrix.log-fetch-method != '' run: | - ./host/cmd_send --host=${{ steps.check-cpu1.outputs.ip-addr }} -D CFE_ES/Application/CMD.NoopCmd + TEST_PROCEDURE=${{ matrix.test-procedure }} + CMDSEND_ES_MID=${{ matrix.es-mid }} + case "${TEST_PROCEDURE%%_*}" in + "eds") + CMDSEND_ES_MID_DEFAULT="CFE_ES/Application/CMD" + CMDSEND_NOOP_CMDCODE="NoopCmd" + CMDSEND_ENDIAN="EDS" + ;; + "trad") + CMDSEND_ES_MID_DEFAULT=0x1806 + CMDSEND_NOOP_CMDCODE="0" + CMDSEND_ENDIAN=$(echo "${TEST_PROCEDURE##*_}" | tr '[a-z]' '[A-Z]') + ;; + esac + echo "CMDSEND_ES_MID=${CMDSEND_ES_MID:-$CMDSEND_ES_MID_DEFAULT}" >> $GITHUB_ENV + echo "CMDSEND_NOOP_CMDCODE=${CMDSEND_NOOP_CMDCODE:-0}" >> $GITHUB_ENV + echo "CMDSEND_ENDIAN=${CMDSEND_ENDIAN:-LE}" >> $GITHUB_ENV + echo "CMDSEND_IP_ADDR=${{ steps.check-cpu1.outputs.ip-addr }}" >> $GITHUB_ENV - - name: Stop CPU1 Container + - name: Execute cpu1 test + if: env.CMDSEND_IP_ADDR != '' + run: | + ./host/cmd_send --host=${CMDSEND_IP_ADDR} --endian=${CMDSEND_ENDIAN} --pktid=${CMDSEND_ES_MID} --cmdcode=${CMDSEND_NOOP_CMDCODE} + + - name: Wait for log messages + if: env.CMDSEND_IP_ADDR != '' + shell: bash + run: | + count=0 + truncate -s 0 check-logs.txt + while [ $count -lt 30 ] && ! grep -q 'CFE_ES 3: No-op command:' check-logs.txt + do + sleep 2 + count=$(($count+1)) + ./fetch_logs.sh > check-logs.txt + done + echo "Check completed after ${count} iterations" + + - name: Collect logs if: always() + uses: actions/upload-artifact@v7 + with: + name: 'CFS Log output (${{ matrix.config }})' + path: check-logs.txt + + # Note that since other non-CFS items can also log things, this also filters + # for the CFS-style timestamp contained in all event and syslog messages from CFE + # This should limit the check to errors that are be relevant + # The build still has some known issues in a couple apps: + # - the HS system monitor may not initialize depending on platform support + # - SBN does not service the SBNSubPipe well enough, and my get limit/overflow errors + # both of these are filtered out here until they can be fixed in the app + - name: Check for message in logs + if: env.CMDSEND_IP_ADDR != '' + shell: bash + run: | + grep -P '\b\d{4}-\d{3}-\d{2}:\d{2}:\d{2}\.\d+ ' check-logs.txt | \ + grep -v 'system monitor initialization' | \ + grep -v 'SBNSubPipe' > cfs-messages.txt + grep -i 'warn\|err\|fail' cfs-messages.txt > warnings.txt || /bin/true + if [ -s warnings.txt ] + then + echo "Start up warnings or failures present:" + cat warnings.txt + /bin/false + elif ! grep -q 'CFE_ES 3: No-op command:' cfs-messages.txt + then + echo "No-op command event missing" + cat cfs-messages.txt + /bin/false + fi + + - name: Stop CPU1 Container + if: always() && steps.start-cpu1.outputs.container-id != '' uses: nasa/cFS/actions/stop-cfs-container@dev with: container-id: ${{ steps.start-cpu1.outputs.container-id }} diff --git a/.gitignore b/.gitignore index 8b9865bda..278fba667 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -build*/ +/build*/ diff --git a/actions/build-app/action.yml b/actions/build-app/action.yml new file mode 100644 index 000000000..72242e52b --- /dev/null +++ b/actions/build-app/action.yml @@ -0,0 +1,62 @@ +name: Build app Workflow +description: 'Build cFS with application' + +inputs: + app-name: + description: Application name + type: string + required: false + default: ${{ github.event.repository.name }} + tag: + description: staging directory tag + type: string + required: false + default: '' + startup-script: + description: startup script to install/override before creating tarball + type: string + required: false + default: '' + +runs: + using: 'composite' + steps: + - name: Setup environment + shell: bash + run: echo "DESTDIR=$GITHUB_WORKSPACE/staging${{ inputs.tag }}" >> $GITHUB_ENV + + - name: Make install + shell: bash + run: make -C build${{ inputs.tag }} mission-install + + - name: Create startup link + shell: bash + run: ln -s core-cpu1 ${DESTDIR}/exe/cpu1/container-start + + - name: Override startup script + if: inputs.startup-script != '' + shell: bash + run: | + cp ${GITHUB_WORKSPACE}/${{ inputs.startup-script }} ${DESTDIR}/exe/cpu1/cf/cfe_es_startup.scr + + - name: Create CPU1 tarball + shell: bash + run: tar Jcv -f ${DESTDIR}/cpu1-bin.tar.xz -C ${DESTDIR}/exe/cpu1 core-cpu1 container-start cf + + - name: Create Other Tarballs + shell: bash + run: | + cd ${DESTDIR}/exe + ls -lR . + find -maxdepth 1 -mindepth 1 -type d | grep -v cpu | while read dir + do + inst=$(basename ${dir}) + echo "Creating ${inst}-bin.tar.xz" + tar Jcv -f ${DESTDIR}/${inst}-bin.tar.xz -C ${inst} . + done + + - name: Upload artifacts + uses: actions/upload-artifact@v7 + with: + name: ${{ inputs.app-name }}-bin${{ inputs.tag }} + path: ${{ env.DESTDIR }}/*-bin.tar.xz diff --git a/actions/healthcheck-logs/action.yml b/actions/healthcheck-logs/action.yml index 154ba2519..4d09e037a 100644 --- a/actions/healthcheck-logs/action.yml +++ b/actions/healthcheck-logs/action.yml @@ -46,7 +46,7 @@ runs: echo "Container IP: $IP_ADDR" - name: Get SSH key - if: inputs.ssh-keyscan == 'true' + if: fromJSON(inputs.ssh-keyscan) shell: bash run: | mkdir -p ~/.ssh diff --git a/actions/setup-app/action.yml b/actions/setup-app/action.yml index 8f8cc4ca3..4c190e95b 100644 --- a/actions/setup-app/action.yml +++ b/actions/setup-app/action.yml @@ -16,7 +16,17 @@ inputs: description: Options to pass to the cmake command type: string required: false - default: '-DENABLE_UNIT_TESTS=TRUE -DSIMULATION=native -DMISSIONCONFIG=sample -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/exe' + default: '-DENABLE_UNIT_TESTS=TRUE -DSIMULATION=native -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/exe' + enable-eds: + description: Whether to enable EDS in the test build + type: boolean + required: false + default: false + config-name: + description: Directory name to use for the initial configuration + type: string + required: false + default: 'sample' runs: using: 'composite' @@ -30,8 +40,19 @@ runs: APP_DEP="${{ inputs.dependency }}" echo "APP_DEP_UPPER=$(echo ${APP_DEP##*/} | sed 's/[a-z]/\U&/g')" >> $GITHUB_ENV echo "APP_DEP_LOWER=$(echo ${APP_DEP##*/} | sed 's/[A-Z]/\L&/g')" >> $GITHUB_ENV + echo "CONFIG_NAME=${{ inputs.config-name }}" >> $GITHUB_ENV + echo "STD_BUILDDIR=build" >> $GITHUB_ENV + + # if EDS is enabled then prepare for two separate build dirs + - name: Set up environment variables for EDS + if: fromJSON(inputs.enable-eds) + shell: bash + run: | + echo "STD_BUILDDIR=build-std" >> $GITHUB_ENV + echo "EDS_BUILDDIR=build-eds" >> $GITHUB_ENV + echo "CFE_EDS_ENABLED=true" >> $GITHUB_ENV - - name: Checkout cFE + - name: Checkout CFE uses: actions/checkout@v6 with: repository: nasa/cFE @@ -62,26 +83,41 @@ runs: - name: Set up basic targets.cmake config shell: bash run: | - cat > ./sample_defs/targets.cmake << EOF + cat > ./${CONFIG_NAME}_defs/targets.cmake << EOF SET(MISSION_NAME GithubActions) SET(SPACECRAFT_ID 0x42) SET(MISSION_CPUNAMES cpu1) SET(cpu1_PROCESSORID 1) - SET(MISSION_GLOBAL_APPLIST) + SET(MISSION_GLOBAL_APPLIST ci_lab to_lab) EOF - name: Add Dependencies to targets if: inputs.app-name != 'cFS' && inputs.app-name != 'cFE' shell: bash - run: echo "LIST(APPEND MISSION_GLOBAL_APPLIST $APP_DEP_LOWER $APP_LOWER)" >> ./sample_defs/targets.cmake + run: | + echo "LIST(APPEND MISSION_GLOBAL_APPLIST $APP_DEP_LOWER $APP_LOWER)" >> ./${CONFIG_NAME}_defs/targets.cmake + echo "LIST(REMOVE_DUPLICATES MISSION_GLOBAL_APPLIST)" >> ./${CONFIG_NAME}_defs/targets.cmake - name: Check targets.cmake shell: bash - run: cat ./sample_defs/targets.cmake + run: cat ./${CONFIG_NAME}_defs/targets.cmake + + # NOTE: Github seems to convert all the inputs to strings, even though it was specified to be a boolean + - name: Set up build tree (eds) + if: fromJSON(inputs.enable-eds) + shell: bash + run: | + export DESTDIR=$GITHUB_WORKSPACE/${EDS_BUILDDIR} + mkdir -p ${DESTDIR} + cd ${DESTDIR} && cmake ${{ inputs.cmake-options }} \ + -DCFE_EDS_ENABLED=ON \ + -DEDSLIB_PYTHON_BUILD_STANDALONE_MODULE=ON \ + -DCFE_MISSIONLIB_PYTHON_BUILD_STANDALONE_MODULE=ON \ + "$GITHUB_WORKSPACE/cfe" - - name: Set up build tree + - name: Set up build tree (std) shell: bash run: | - mkdir -p $GITHUB_WORKSPACE/build - echo DESTDIR=$GITHUB_WORKSPACE/build >> $GITHUB_ENV - cd $GITHUB_WORKSPACE/build && cmake ${{ inputs.cmake-options }} "$GITHUB_WORKSPACE/cfe" + export DESTDIR=$GITHUB_WORKSPACE/${STD_BUILDDIR} + mkdir -p ${DESTDIR} + cd ${DESTDIR} && cmake ${{ inputs.cmake-options }} "$GITHUB_WORKSPACE/cfe" diff --git a/custom-rules.mk b/custom-rules.mk index af730f502..7961b5219 100644 --- a/custom-rules.mk +++ b/custom-rules.mk @@ -1,8 +1,8 @@ # This converts the staging directory from "make install" into a virtual # filesystem that can be mounted in a VM or container -YOCTO_SANDBOX_REPO = https://developer.nasa.gov/cFS/yocto-sandbox -YOCTO_SANDBOX_TAG = v0.0.3-testing +YOCTO_SANDBOX_REPO = ghcr.io/core-flight-system +YOCTO_SANDBOX_TAG = latest PARTED_CMD ?= /usr/sbin/parted @@ -37,12 +37,24 @@ RTEMS5_APPEND_OPTS += --console=/dev/com1 RTEMS5_APPEND_OPTS += --batch-mode -$(QEMU_YOCTO_DEPLOY_DIR)/fetch_yocto_rootfs.cpu1.stamp: SYSTEM_PACKAGE = qemuriscv64-target-bin.tar.xz -$(QEMU_YOCTO_DEPLOY_DIR)/fetch_yocto_rootfs.cpu2.stamp: SYSTEM_PACKAGE = qemumips-target-bin.tar.xz +$(QEMU_YOCTO_DEPLOY_DIR)/fetch_yocto_rootfs.cpu1.stamp: $(QEMU_YOCTO_DEPLOY_DIR)/extract_yocto_rootfs.qemuriscv64.stamp +#SYSTEM_CONTAINER = yocto-image-qemuriscv64 +$(QEMU_YOCTO_DEPLOY_DIR)/fetch_yocto_rootfs.cpu2.stamp: $(QEMU_YOCTO_DEPLOY_DIR)/extract_yocto_rootfs.qemumips.stamp +#SYSTEM_CONTAINER = yocto-image-qemumips -$(DEPLOY_DIR)/fetch_yocto_rootfs.%.stamp: - mkdir -p $(DEPLOY_DIR)/$(CPUNAME) - curl -fsL $(YOCTO_SANDBOX_REPO)/releases/download/$(YOCTO_SANDBOX_TAG)/$(SYSTEM_PACKAGE) | tar Jxv -C $(DEPLOY_DIR)/$(CPUNAME) -f - +$(DEPLOY_DIR)/extract_yocto_rootfs.%.stamp: + /bin/bash -x ./create_yocto_rootfs.sh $(DEPLOY_DIR) $(YOCTO_SANDBOX_REPO)/yocto-image-$(*):$(YOCTO_SANDBOX_TAG) + touch "$(@)" + +$(DEPLOY_DIR)/fetch_yocto_rootfs.cpu1.stamp: + cp -Lv -t $(DEPLOY_DIR)/cpu1 $(DEPLOY_DIR)/images/qemuriscv64/core-image-cfecfs-qemuriscv64.rootfs.ext4 + cp -Lv -t $(DEPLOY_DIR)/cpu1 $(DEPLOY_DIR)/images/qemuriscv64/fw_jump.elf + cp -Lv -t $(DEPLOY_DIR)/cpu1 $(DEPLOY_DIR)/images/qemuriscv64/Image + touch "$(@)" + +$(DEPLOY_DIR)/fetch_yocto_rootfs.cpu2.stamp: + cp -Lv -t $(DEPLOY_DIR)/cpu2 $(DEPLOY_DIR)/images/qemumips/core-image-cfecfs-qemumips.rootfs.ext4 + cp -Lv -t $(DEPLOY_DIR)/cpu2 $(DEPLOY_DIR)/images/qemumips/vmlinux touch "$(@)" # generic rule for creating a CFS tarball @@ -89,14 +101,6 @@ $(DEPLOY_DIR)/fetch_yocto_rootfs.%.stamp: dd if=$(<) of=$(@).tmp bs=512 seek=63 mv -v "$(@).tmp" "$(@)" -# generic rule for creating a disk image from a fat filesystem image -%.diskimg: %.fat - mkdir -p "$(dir $(@))" - truncate -s $(IMAGE_SIZE) $(@) - $(PARTED_CMD) -s $(@) -- mklabel msdos - $(PARTED_CMD) -a none -s $(@) -- mkpart primary fat32 63s -1s - dd if=$(<) of=$(@) bs=512 seek=63 - %/rtems-cfs.exe: $(O)/stamp.install mkdir -p "$(dir $(@))" cp -v "$(O)/exe/$(CPUNAME)/core-$(CPUNAME).exe" "$(@)" @@ -124,11 +128,6 @@ $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/container-start: QEMU_KERNEL = -kernel rtems $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/container-start: $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/rtems-cfs.exe $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/container-start: $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/cfs-cpu1.diskimg -$(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/container-start: CPUNAME = cpu2 -$(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/container-start: QEMU_KERNEL = -kernel rtems-cfs.exe -append '$(RTEMS5_APPEND_OPTS)' -$(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/container-start: $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/rtems-cfs.exe -$(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/container-start: $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/cfs-cpu2.diskimg - %/container-start: custom-rules.mk truncate -s 0 "$(@)" echo -n "$(QEMU_HYPERVISOR) " >> "$(@)" @@ -141,14 +140,14 @@ $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/container-start: $(QEMU_PC686_RTEMS_DEPLOY_D $(O_qemu_yocto_linux)/stamp.image: QEMU_DISK_OPTS += -drive id=disk0,file=$(ROOTFS_IMAGE_BASENAME).$(IMAGE_TYPE),format=$(IMAGE_FORMAT) $(O_qemu_yocto_linux)/stamp.image: QEMU_DISK_OPTS += -drive id=disk1,file=$(CFS_IMAGE_BASENAME).$(IMAGE_TYPE),format=$(IMAGE_FORMAT) -$(O_qemu_yocto_linux)/stamp.image: $(QEMU_YOCTO_DEPLOY_DIR)/cpu1/container-start -$(O_qemu_yocto_linux)/stamp.image: $(QEMU_YOCTO_DEPLOY_DIR)/cpu2/container-start +# Disabled until the workflow issues can be fixed +#$(O_qemu_yocto_linux)/stamp.image: $(QEMU_YOCTO_DEPLOY_DIR)/cpu1/container-start +#$(O_qemu_yocto_linux)/stamp.image: $(QEMU_YOCTO_DEPLOY_DIR)/cpu2/container-start $(O_pc686_rtems5)/stamp.image: QEMU_HYPERVISOR = qemu-system-i386 -m 128M -no-reboot $(O_pc686_rtems5)/stamp.image: QEMU_NETDEV_TYPE = i82557b $(O_pc686_rtems5)/stamp.image: QEMU_DISK_OPTS += -drive id=disk0,file=$(CFS_IMAGE_BASENAME).diskimg,format=raw $(O_pc686_rtems5)/stamp.image: $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu1/container-start -$(O_pc686_rtems5)/stamp.image: $(QEMU_PC686_RTEMS_DEPLOY_DIR)/cpu2/container-start # do not auto-delete these artifacts .PRECIOUS: %.ext4 %.qcow2 diff --git a/sample_defs/generate_startup.cmake b/sample_defs/generate_startup.cmake index 3a794d375..ce2f6e327 100644 --- a/sample_defs/generate_startup.cmake +++ b/sample_defs/generate_startup.cmake @@ -14,11 +14,9 @@ function (generate_cfs_startup_script CFS_INSTALL_DIR) # the rest of the apps can vary by config set(CFS_APP_STARTUP_ORDER lc cf ds fm hk hs mm sc md cs sbn) foreach(APP ${CFS_APP_STARTUP_ORDER}) - message("Test: ${APP} in ${CFS_INSTALL_APPLIST}") list(FIND ARGN ${APP} SHOULD_START) if (SHOULD_START GREATER -1) string(TOUPPER "${APP}" APP_UPPER) - message("yes to ${APP_UPPER}") file (APPEND ${STARTUP_FILE} "CFE_APP, ${APP}, ${APP_UPPER}_AppMain, ${APP_UPPER}, 70, 131072, 0x0, 0;\n" ) diff --git a/sample_defs/toolchain-mips32r2-poky-linux.cmake b/sample_defs/toolchain-mips32r2-poky-linux.cmake index 9cd1363ad..d91c1da05 100644 --- a/sample_defs/toolchain-mips32r2-poky-linux.cmake +++ b/sample_defs/toolchain-mips32r2-poky-linux.cmake @@ -3,7 +3,7 @@ # Basic cross system configuration SET(CMAKE_SYSTEM_NAME Linux) -SET(CMAKE_SYSTEM_VERSION 5.0.12) +SET(CMAKE_SYSTEM_VERSION 5.0) SET(CMAKE_SYSTEM_PROCESSOR mips) SET(POKY_SYSROOT_ID mips32r2-poky-linux) diff --git a/sample_defs/toolchain-riscv64-poky-linux.cmake b/sample_defs/toolchain-riscv64-poky-linux.cmake index 306a4a122..7d8333fae 100644 --- a/sample_defs/toolchain-riscv64-poky-linux.cmake +++ b/sample_defs/toolchain-riscv64-poky-linux.cmake @@ -3,7 +3,7 @@ # Basic cross system configuration SET(CMAKE_SYSTEM_NAME Linux) -SET(CMAKE_SYSTEM_VERSION 5.0.12) +SET(CMAKE_SYSTEM_VERSION 5.0) SET(CMAKE_SYSTEM_PROCESSOR riscv64) SET(POKY_SYSROOT_ID riscv64-poky-linux) From faa596425e891f57ff47f41962c3d443b2edea9e Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 7 May 2026 16:41:43 -0400 Subject: [PATCH 2/4] Fix #998, update build run app --- .github/workflows/build-run-app-reusable.yml | 153 +++++++++++++------ 1 file changed, 108 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build-run-app-reusable.yml b/.github/workflows/build-run-app-reusable.yml index d77893858..4bcc5682b 100644 --- a/.github/workflows/build-run-app-reusable.yml +++ b/.github/workflows/build-run-app-reusable.yml @@ -25,6 +25,11 @@ on: type: string required: false default: 'AppMain' + enable-eds: + description: Whether to enable EDS in the test build + type: boolean + required: false + default: false # Force bash to apply pipefail option so pipeline failures aren't masked defaults: @@ -61,6 +66,7 @@ jobs: with: app-name: ${{ inputs.app-name }} dependency: ${{ inputs.dependency }} + enable-eds: ${{ inputs.enable-eds }} - name: Set up start string for verification run: | @@ -70,58 +76,83 @@ jobs: echo "START_STRING=${{ inputs.startup-string }}" >> $GITHUB_ENV fi - - name: Make install - run: make -C build mission-install - - - name: Generate Startup Link - run: ln -s core-cpu1 ./build/exe/cpu1/container-start - - - name: Replace startup script - run: | - truncate -s 0 ./build/exe/cpu1/cf/cfe_es_startup.scr - if [ "x$APP_DEP_LOWER" != "x" ] - then - echo "CFE_LIB, $APP_DEP_LOWER, ${APP_DEP_UPPER}_Init, $APP_DEP_UPPER, 0, 0, 0x0, 0;" >> ./build/exe/cpu1/cf/cfe_es_startup.scr - fi - echo "CFE_APP, $APP_LOWER, ${APP_UPPER}_${{ inputs.app-entrypoint-suffix }}, $APP_UPPER, 80, 16384, 0x0, 0;" >> ./build/exe/cpu1/cf/cfe_es_startup.scr - cat ./build/exe/cpu1/cf/cfe_es_startup.scr - - - name: Archive binaries + - name: Create startup script generator run: | - cd $GITHUB_WORKSPACE/build/exe - find -maxdepth 1 -mindepth 1 -type d | while read dir - do - inst=$(basename ${dir}) - tar Jcv -f $GITHUB_WORKSPACE/${inst}-bin.tar.xz -C ${inst} . - done + cat > generate_startup_script.cmake << 'EOF' + include ("$ENV{CONFIG_NAME}_defs/targets.cmake") + foreach(APP ${MISSION_GLOBAL_APPLIST}) + if (IS_DIRECTORY "./apps/${APP}" AND NOT "${APP}" STREQUAL "${EXCLUDE}") + string (TOUPPER ${APP} APP_UPPER) + message("CFE_APP, ${APP}, ${APP_UPPER}_AppMain, ${APP_UPPER}, 80, 16384, 0x0, 0;") + endif() + endforeach(APP) + EOF + truncate -s 0 ${GITHUB_WORKSPACE}/generated_cfe_es_startup.scr + + - name: Add dependency to startup script + if: ${{ inputs.dependency != '' }} + run: echo "CFE_LIB, $APP_DEP_LOWER, ${APP_DEP_UPPER}_Init, $APP_DEP_UPPER, 0, 0, 0x0, 0;" >> ${GITHUB_WORKSPACE}/generated_cfe_es_startup.scr + + # Note that cmake messages get output on stderr, not stdout + - name: Add other apps to startup script + run: cmake -DEXCLUDE=$APP_LOWER -P generate_startup_script.cmake 2>&1 | tee -a ${GITHUB_WORKSPACE}/generated_cfe_es_startup.scr + + - name: Add subject app to startup script + run: echo "CFE_APP, $APP_LOWER, ${APP_UPPER}_${{ inputs.app-entrypoint-suffix }}, $APP_UPPER, 80, 16384, 0x0, 0;" >> ${GITHUB_WORKSPACE}/generated_cfe_es_startup.scr + + - name: Check startup script + if: always() + run: cat ${GITHUB_WORKSPACE}/generated_cfe_es_startup.scr + + - name: Build and upload artifacts (std) + uses: nasa/workflows/actions/build-app@dev + with: + app-name: ${{ inputs.app-name }} + tag: ${{ fromJSON(inputs.enable-eds) && '-std' || '' }} + startup-script: generated_cfe_es_startup.scr - - name: Upload all artifacts - uses: actions/upload-artifact@v7 + - name: Build and upload artifacts (eds) + if: fromJSON(inputs.enable-eds) + uses: nasa/workflows/actions/build-app@dev with: - name: ${{ inputs.app-name }}-bin - path: ./*.tar.xz + app-name: ${{ inputs.app-name }} + tag: '-eds' + startup-script: generated_cfe_es_startup.scr run-app: needs: build-app - name: Run CFE with app, check for startup messages + name: Run CFE with app, check for startup messages (${{ matrix.variant }}) runs-on: ubuntu-22.04 + strategy: + fail-fast: true + matrix: + variant: [ 'std', 'eds' ] + exclude: + - variant: ${{ !fromJSON(inputs.enable-eds) && 'eds' }} steps: + - name: Check build tag + run: + echo "BUILD_TAG=${{ fromJSON(inputs.enable-eds) && format('-{0}', matrix.variant) || '' }}" >> $GITHUB_ENV + - name: Download artifact uses: actions/download-artifact@v8 with: - name: ${{ inputs.app-name }}-bin - path: ${{ inputs.app-name }}-bin + name: ${{ inputs.app-name }}-bin${{ env.BUILD_TAG }} + path: ${{ inputs.app-name }}-bin${{ env.BUILD_TAG }} - name: List Files 1 run: ls -lR . - name: Unpack artifacts run: | - for i in cpu1 host + for i in cpu1 host lib do - mkdir -p "$i" - tar Jxv -C "$i" -f "$GITHUB_WORKSPACE/${{ inputs.app-name }}-bin/$i-bin.tar.xz" + tarball="$GITHUB_WORKSPACE/${{ inputs.app-name }}-bin${{ env.BUILD_TAG }}/$i-bin.tar.xz" + if [ -e "$tarball" ]; then + mkdir -p "${{ matrix.variant }}/$i" + tar Jxv -C "${{ matrix.variant }}/$i" -f "$tarball" + fi done - name: List Files 2 @@ -129,11 +160,20 @@ jobs: pwd ls -lR . + - name: Get IP address of host container + shell: bash + id: query-local-ip-addr + run: | + IP_ADDR=$(docker inspect "${HOSTNAME}" --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}') + echo addr=$IP_ADDR >> $GITHUB_OUTPUT + echo Local IP: $IP_ADDR + - name: Start CPU1 container id: start-cpu1 uses: nasa/cFS/actions/start-cfs-container@dev with: - binary-dir: ${{ github.workspace }}/cpu1 + binary-dir: ${{ github.workspace }}/${{ matrix.variant }}/cpu1 + exec-image: ghcr.io/core-flight-system/cfsexec-linux:latest - name: Check CPU1 container id: check-cpu1 @@ -142,18 +182,41 @@ jobs: container-id: ${{ steps.start-cpu1.outputs.container-id }} healthcheck-regex: 'CFE_ES_Main entering OPERATIONAL state$' - - name: Shut down CFE - if: ${{ steps.check-cpu1.outputs.ip-addr != '' }} - working-directory: ./host + # For now only run the "aliveness" test -- all apps should have this, and it does not depend + # on any externals like tables or other apps + - name: Execute Test Script (EDS) + if: ${{ matrix.variant == 'eds' && steps.check-cpu1.outputs.ip-addr != '' }} + working-directory: ${{ matrix.variant }}/host + run: | + export LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/${{ matrix.variant }}/lib + export PYTHONPATH=${GITHUB_WORKSPACE}/${{ matrix.variant }}/lib/python + ./runtest.py --instance-name 'cpu1' \ + --remote-addr '${{ steps.check-cpu1.outputs.ip-addr }}:1234' \ + --local-addr '${{ steps.query-local-ip-addr.outputs.addr }}:2234' \ + --mission-name 'githubactions' \ + '${{ inputs.app-name }}' 'test_aliveness' + sleep 2 + + - name: Shut down CFE (STD) + if: ${{ matrix.variant == 'std' && steps.check-cpu1.outputs.ip-addr != '' }} + working-directory: ${{ matrix.variant }}/host run: | ./cmd_send -v --host=${{ steps.check-cpu1.outputs.ip-addr }} --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 sleep 2 + - name: Shut down CFE (EDS) + if: ${{ matrix.variant == 'eds' && steps.check-cpu1.outputs.ip-addr != '' }} + working-directory: ${{ matrix.variant }}/host + run: | + ./cmd_send -v --host=${{ steps.check-cpu1.outputs.ip-addr }} --endian=EDS --pktid=CFE_ES/Application/CMD --cmdcode=RestartCmd RestartType=2 + sleep 2 + - name: Capture Logs if: ${{ always() && steps.start-cpu1.outputs.container-id != '' }} - run: docker logs ${{ steps.start-cpu1.outputs.container-id }} > cFS_startup_cpu1.txt + run: docker logs ${{ steps.start-cpu1.outputs.container-id }} > ${{ matrix.variant }}/cFS_startup_cpu1.txt - name: Stop CPU1 Container + #if: ${{ always() && steps.start-cpu1.outputs.container-id != '' }} uses: nasa/cFS/actions/stop-cfs-container@dev with: container-id: ${{ steps.start-cpu1.outputs.container-id }} @@ -162,25 +225,25 @@ jobs: if: success() || failure() uses: actions/upload-artifact@v7 with: - name: cFS_startup_log - path: cFS_startup_cpu1.txt + name: cFS_startup_log${{ env.BUILD_TAG }} + path: ${{ matrix.variant }}/cFS_startup_cpu1.txt - name: Confirm startup string run: | - if [[ -z $(grep "$START_STRING" cFS_startup_cpu1.txt) ]]; then + if [[ -z $(grep "$START_STRING" ${{ matrix.variant }}/cFS_startup_cpu1.txt) ]]; then echo "Startup verification string not found in log: $START_STRING" echo "" echo "Possible related event messages:" - grep "/$APP_UPPER " cFS_startup_cpu1.txt + grep "/$APP_UPPER " ${{ matrix.variant }}/cFS_startup_cpu1.txt exit -1 fi - name: Check for cFS Warnings if: success() || failure() run: | - if [[ -n $(grep -i "warn\|err\|fail" cFS_startup_cpu1.txt) ]]; then + if [[ -n $(grep -i "warn\|err\|fail" ${{ matrix.variant }}/cFS_startup_cpu1.txt) ]]; then echo "cFS startup warn|err|fail:" echo "" - grep -i 'warn\|err\|fail' cFS_startup_cpu1.txt + grep -i 'warn\|err\|fail' ${{ matrix.variant }}/cFS_startup_cpu1.txt exit -1 - fi \ No newline at end of file + fi From cd85f73f8c9bd824ef3fd26d48b14e1b3e96a0f4 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 7 May 2026 18:06:29 -0400 Subject: [PATCH 3/4] Fix #998, updates from review comments --- .github/workflows/build-run-app-reusable.yml | 4 ++-- .github/workflows/codeql-reusable.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-run-app-reusable.yml b/.github/workflows/build-run-app-reusable.yml index 4bcc5682b..5d1aeffd9 100644 --- a/.github/workflows/build-run-app-reusable.yml +++ b/.github/workflows/build-run-app-reusable.yml @@ -105,7 +105,7 @@ jobs: run: cat ${GITHUB_WORKSPACE}/generated_cfe_es_startup.scr - name: Build and upload artifacts (std) - uses: nasa/workflows/actions/build-app@dev + uses: nasa/cFS/actions/build-app@dev with: app-name: ${{ inputs.app-name }} tag: ${{ fromJSON(inputs.enable-eds) && '-std' || '' }} @@ -113,7 +113,7 @@ jobs: - name: Build and upload artifacts (eds) if: fromJSON(inputs.enable-eds) - uses: nasa/workflows/actions/build-app@dev + uses: nasa/cFS/actions/build-app@dev with: app-name: ${{ inputs.app-name }} tag: '-eds' diff --git a/.github/workflows/codeql-reusable.yml b/.github/workflows/codeql-reusable.yml index c2a6bdb54..9ef7f74bd 100644 --- a/.github/workflows/codeql-reusable.yml +++ b/.github/workflows/codeql-reusable.yml @@ -30,7 +30,7 @@ on: prep: description: 'Make Prep' - default: 'make native_std.prep' + default: make prep required: false type: string From 5fe57c40104b8b95c30a188b3414834d4378c71d Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 7 May 2026 18:47:10 -0400 Subject: [PATCH 4/4] Fix #998, resolve local ip address Update to resolve local IP address when not in docker --- .github/workflows/build-run-app-reusable.yml | 25 +++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-run-app-reusable.yml b/.github/workflows/build-run-app-reusable.yml index 5d1aeffd9..7478b8e7c 100644 --- a/.github/workflows/build-run-app-reusable.yml +++ b/.github/workflows/build-run-app-reusable.yml @@ -160,14 +160,6 @@ jobs: pwd ls -lR . - - name: Get IP address of host container - shell: bash - id: query-local-ip-addr - run: | - IP_ADDR=$(docker inspect "${HOSTNAME}" --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}') - echo addr=$IP_ADDR >> $GITHUB_OUTPUT - echo Local IP: $IP_ADDR - - name: Start CPU1 container id: start-cpu1 uses: nasa/cFS/actions/start-cfs-container@dev @@ -182,6 +174,23 @@ jobs: container-id: ${{ steps.start-cpu1.outputs.container-id }} healthcheck-regex: 'CFE_ES_Main entering OPERATIONAL state$' + # this looks for something from "hostname -I" that appears to be on the same subnet as the cFS container + - name: Get IP address of host container + shell: bash + id: query-local-ip-addr + run: | + cont_ip=${{ steps.check-cpu1.outputs.ip-addr }} + for ip in $(hostname -I) + do + first_ip=${first_ip:-${ip}} + if [ "${ip%.*}" = "${cont_ip%.*}" ] + then + local_ip=${ip} + fi + done + echo addr=${local_ip:-${first_ip}} >> $GITHUB_OUTPUT + echo Local IP: ${local_ip:-${first_ip}} + # For now only run the "aliveness" test -- all apps should have this, and it does not depend # on any externals like tables or other apps - name: Execute Test Script (EDS)