Skip to content

Add integration and unit tests for DMOD_LOG_STEP_* macros #1008

Add integration and unit tests for DMOD_LOG_STEP_* macros

Add integration and unit tests for DMOD_LOG_STEP_* macros #1008

Workflow file for this run

name: CI
on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master, feature/* ]
jobs:
cmake-build:
name: 'CMAKE: Build for x86_64'
runs-on: ubuntu-latest
container:
image: chocotechnologies/dmod:1.0.4
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clean build directory
run: rm -rf build
- name: Create build directory
run: mkdir -p build
- name: Configure CMake for MODULE mode
working-directory: build
run: cmake .. -DDMOD_MODE=DMOD_MODULE -DDMOD_TOOLS_NAME=arch/x86_64
- name: Build MODULE mode
working-directory: build
run: cmake --build .
- name: Configure CMake for SYSTEM mode
working-directory: build
run: cmake .. -DDMOD_MODE=DMOD_SYSTEM -DDMOD_TOOLS_NAME=arch/x86_64
- name: Build SYSTEM mode
working-directory: build
run: cmake --build .
- name: Test loader with example_app.dmf
working-directory: build
run: ./examples/system/dmod_loader/dmod_loader ./dmf/example_app.dmf
- name: Test loader with MyApplication.dmf
working-directory: build
run: ./examples/system/dmod_loader/dmod_loader ./dmf/MyApplication.dmf
- name: Test loader with module name (example_app)
working-directory: build
run: ./examples/system/dmod_loader/dmod_loader example_app
- name: Test loader with module name (MyApplication)
working-directory: build
run: ./examples/system/dmod_loader/dmod_loader MyApplication
- name: Test loader with non-existent module name
working-directory: build
run: |
if ./examples/system/dmod_loader/dmod_loader nonexistent_module 2>&1 | grep -q "Cannot find module file for module name"; then
echo "Correctly failed to load non-existent module"
else
echo "Expected error message not found"
exit 1
fi
- name: Test DIF functionality
working-directory: build
run: |
./examples/system/dif_test/dif_test
./examples/system/dif_test/test_direct_access
- name: Test DMOD_LOG_STEP_* macros via log_step module
working-directory: build
run: |
./examples/system/dmod_loader/dmod_loader ./dmf/log_step.dmf
echo "log_step module loaded and executed successfully"
- name: Run manifest library tests
working-directory: build
run: ./tests/tests_dmod_manifest
- name: Run dmf-get integration tests
working-directory: tests/integration
run: bash test_dmf_get.sh ../../build
- name: Run todmd integration tests
working-directory: tests/integration
run: bash test_todmd.sh ../../build
- name: Run whereisdmf integration tests
working-directory: tests/integration
run: bash test_whereisdmf.sh ../../build
- name: Test dmod_link_modules with dmini
run: |
mkdir -p .github/test_dmod_link_modules/build
cd .github/test_dmod_link_modules/build
cmake .. -DDMOD_MODE=DMOD_MODULE
cmake --build .
echo "dmod_link_modules test completed successfully"
- name: Verify dmini headers were downloaded
run: |
if [ -d ".github/test_dmod_link_modules/build/dmf/inc/dmini/include" ]; then
echo "SUCCESS: dmini headers downloaded to build/dmf/inc/dmini/include"
ls -la .github/test_dmod_link_modules/build/dmf/inc/dmini/include/
else
echo "ERROR: dmini headers not found at expected location"
echo "Searching for dmini directories..."
find .github/test_dmod_link_modules/build -name "dmini" -type d || true
exit 1
fi
- name: Test loading module built with dmod_link_modules
run: |
./build/examples/system/dmod_loader/dmod_loader .github/test_dmod_link_modules/build/dmf/test_link.dmf
echo "Module with linked dependencies loaded successfully"
- name: Run coverage check
working-directory: build
run: cmake --build . --target coverage_check
continue-on-error: true
- name: Build compressed DMF
working-directory: build
run: |
echo "Building compressed DMF"
cmake .. -DDMOD_MODE=DMOD_MODULE -DDMOD_TOOLS_NAME=arch/x86_64
cmake --build .
- name: Test loader with compressed example_app.dmfc
working-directory: build
run: ./examples/system/dmod_loader/dmod_loader ./dmfc/example_app.dmfc
- name: Test loader with compressed DMF after removing dmf directory
working-directory: build
run: |
rm -rf dmf
./examples/system/dmod_loader/dmod_loader ./dmfc/example_app.dmfc
- name: Create DMP package from DMF files
working-directory: build
run: |
# Rebuild DMF files (remove artifacts to force rebuild after dmf was deleted)
rm -rf examples/module examples/dif templates/module/output
cmake .. -DDMOD_MODE=DMOD_MODULE -DDMOD_TOOLS_NAME=arch/x86_64
cmake --build .
# Create DMP package with vfs as main module
./bin/tools/todmp test_package ./dmf ./test_package.dmp vfs
echo "DMP package created successfully"
- name: List DMP package contents
working-directory: build
run: |
./bin/tools/todmp -l ./test_package.dmp
echo "DMP package listing completed"
- name: Test loading DMP package
working-directory: build
run: |
./examples/system/dmod_loader/dmod_loader ./test_package.dmp
echo "DMP package loaded and executed successfully"
- name: Create DMP package without main module
working-directory: build
run: |
./bin/tools/todmp libs_package ./dmf ./libs_package.dmp
echo "DMP package without main module created successfully"
- name: Test todmp help and version
working-directory: build
run: |
./bin/tools/todmp --help
./bin/tools/todmp --version
make-build:
name: 'MAKE: Build for x86_64'
runs-on: ubuntu-latest
container:
image: chocotechnologies/dmod:1.0.4
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clean build directory
run: rm -rf build
- name: Build MODULE mode with Make
run: make DMOD_MODE=DMOD_MODULE
- name: Build SYSTEM mode with Make
run: make DMOD_MODE=DMOD_SYSTEM
- name: Test loader with example_app.dmf
run: chmod +x ./build/examples/system/dmod_loader && ./build/examples/system/dmod_loader build/dmf/example_app.dmf
- name: Test loader with module name (example_app)
run: ./build/examples/system/dmod_loader example_app
- name: Test loader with non-existent module name
run: |
if ./build/examples/system/dmod_loader nonexistent_module 2>&1 | grep -q "Cannot find module file for module name"; then
echo "Correctly failed to load non-existent module"
else
echo "Expected error message not found"
exit 1
fi
- name: Build compressed modules with Make
run: make DMOD_MODE=DMOD_MODULE
- name: Test loader with compressed example_app.dmfc
run: ./build/examples/system/dmod_loader build/dmfc/example_app.dmfc
- name: Test loader with compressed DMF after removing dmf directory
run: |
rm -rf build/dmf
./build/examples/system/dmod_loader build/dmfc/example_app.dmfc
- name: DIF test
run: |
chmod +x ./build/examples/dif_test/dif_test
./build/examples/dif_test/dif_test
- name: Create DMP package from DMF files
run: |
# Rebuild DMF files (remove artifacts to force rebuild)
rm -rf build/examples/module build/examples/dif build/templates/module/output
make DMOD_MODE=DMOD_MODULE
# Create DMP package with vfs as main module
./build/bin/tools/todmp test_package ./build/dmf ./build/test_package.dmp vfs
echo "DMP package created successfully"
- name: List DMP package contents
run: |
./build/bin/tools/todmp -l ./build/test_package.dmp
echo "DMP package listing completed"
- name: Test loading DMP package
run: |
./build/examples/system/dmod_loader ./build/test_package.dmp
echo "DMP package loaded and executed successfully"
- name: Create DMP package without main module
run: |
./build/bin/tools/todmp libs_package ./build/dmf ./build/libs_package.dmp
echo "DMP package without main module created successfully"
- name: Test todmp help and version
run: |
./build/bin/tools/todmp --help
./build/bin/tools/todmp --version
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dmod-build-artifacts
path: |
./build/examples/system/dmod_loader
./build/examples/dif_test/dif_test
./build/dmf/example_app.dmf
./build/dmf/dmodex.dmf
./build/test_package.dmp
./build/libs_package.dmp
external-module-cmake:
name: 'CMAKE: Test external module build'
runs-on: ubuntu-latest
container:
image: chocotechnologies/dmod:1.0.4
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build dmod in MODULE mode
run: |
mkdir -p build
cd build
cmake .. -DDMOD_MODE=DMOD_MODULE -DDMOD_TOOLS_NAME=arch/x86_64
cmake --build .
- name: Build dmod in SYSTEM mode for loader
run: |
cd build
cmake .. -DDMOD_MODE=DMOD_SYSTEM -DDMOD_TOOLS_NAME=arch/x86_64
cmake --build . --target dmod_loader
- name: Create external module directory
run: |
./scripts/new-module.sh \
--name external_test \
--type application \
--path /tmp/external_test_module \
--dmod-dir "${GITHUB_WORKSPACE}" \
--author "CI Test"
- name: Build external module with CMake
run: |
cd /tmp/external_test_module
mkdir -p build
cd build
cmake ..
cmake --build .
- name: Verify external module DMF was created
run: |
test -f /tmp/external_test_module/build/dmf/external_test.dmf
echo "External module DMF created successfully"
- name: Test external module with dmod_loader
run: |
cd /tmp/external_test_module/build
${GITHUB_WORKSPACE}/build/examples/system/dmod_loader/dmod_loader ./dmf/external_test.dmf
external-module-make:
name: 'MAKE: Test external module build'
runs-on: ubuntu-latest
container:
image: chocotechnologies/dmod:1.0.4
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build dmod with Make in MODULE mode
run: make DMOD_MODE=DMOD_MODULE
- name: Build dmod with Make in SYSTEM mode for loader
run: make DMOD_MODE=DMOD_SYSTEM
- name: Rebuild dmod in MODULE mode before external module
run: make DMOD_MODE=DMOD_MODULE
- name: Create external module directory
run: |
./scripts/new-module.sh \
--name external_test_make \
--type application \
--path /tmp/external_test_module_make \
--dmod-dir "${GITHUB_WORKSPACE}" \
--author "CI Test"
- name: Build external module with Make
run: |
cd /tmp/external_test_module_make
make
- name: Verify external module DMF was created
run: |
test -f ${GITHUB_WORKSPACE}/build/dmf/external_test_make.dmf
echo "External module DMF created successfully with Make"
- name: Test external module with dmod_loader
run: |
${GITHUB_WORKSPACE}/build/examples/system/dmod_loader ${GITHUB_WORKSPACE}/build/dmf/external_test_make.dmf