This commit is contained in:
@@ -35,13 +35,13 @@ jobs:
|
|||||||
apt-cache policy libusb-1.0-0-dev
|
apt-cache policy libusb-1.0-0-dev
|
||||||
echo "=== End dependency package version ==="
|
echo "=== End dependency package version ==="
|
||||||
- name: Build ptprnt debug
|
- name: Build ptprnt debug
|
||||||
run: scripts/build.sh debug --coverage --test
|
run: scripts/build.sh -j2 debug --coverage --test
|
||||||
- name: Generate coverage
|
- name: Generate coverage
|
||||||
run: scripts/generate_coverage.sh --text
|
run: scripts/generate_coverage.sh --text
|
||||||
- name: Coverage report
|
- name: Coverage report
|
||||||
run: cat ./coverageReport/coverage.txt
|
run: cat ./coverageReport/coverage.txt
|
||||||
- name: build and release
|
- name: build release
|
||||||
run: scripts/build.sh release
|
run: scripts/build.sh -j2 release
|
||||||
- name: upload release binary
|
- name: upload release binary
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -204,10 +204,10 @@ This is a modern C++20 rewrite of [ptouch-print](https://git.familie-radermacher
|
|||||||
|
|
||||||
**Build script:**
|
**Build script:**
|
||||||
```bash
|
```bash
|
||||||
# Release build
|
# Release build (tests disabled for faster builds)
|
||||||
./scripts/build.sh release
|
./scripts/build.sh release
|
||||||
|
|
||||||
# Debug build
|
# Debug build (tests enabled)
|
||||||
./scripts/build.sh debug
|
./scripts/build.sh debug
|
||||||
|
|
||||||
# Debug with tests
|
# Debug with tests
|
||||||
@@ -223,6 +223,8 @@ This is a modern C++20 rewrite of [ptouch-print](https://git.familie-radermacher
|
|||||||
./scripts/build.sh --help
|
./scripts/build.sh --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** Tests are only built in debug mode to keep release builds fast and small. Release builds do not include test binaries or link against gtest/gmock.
|
||||||
|
|
||||||
**Running tests:**
|
**Running tests:**
|
||||||
```bash
|
```bash
|
||||||
# Using build script
|
# Using build script
|
||||||
|
|||||||
23
meson.build
23
meson.build
@@ -63,13 +63,20 @@ ptprnt_exe = executable(
|
|||||||
)
|
)
|
||||||
|
|
||||||
### Unit tests
|
### Unit tests
|
||||||
|
# Only build tests for debug builds or when explicitly enabled
|
||||||
|
build_tests = get_option('buildtype') == 'debug' or get_option('build_tests')
|
||||||
|
|
||||||
# GTest and GMock
|
if build_tests
|
||||||
gtest_proj = subproject('gtest')
|
# GTest and GMock
|
||||||
gtest_dep = gtest_proj.get_variable('gtest_main_dep')
|
gtest_proj = subproject('gtest')
|
||||||
gmock_dep = gtest_proj.get_variable('gmock_main_dep')
|
gtest_dep = gtest_proj.get_variable('gtest_main_dep')
|
||||||
if not gtest_dep.found()
|
gmock_dep = gtest_proj.get_variable('gmock_main_dep')
|
||||||
error('MESON_SKIP_TEST: gtest not installed.')
|
if not gtest_dep.found()
|
||||||
endif
|
error('MESON_SKIP_TEST: gtest not installed.')
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('tests')
|
subdir('tests')
|
||||||
|
message('Tests enabled (buildtype=' + get_option('buildtype') + ')')
|
||||||
|
else
|
||||||
|
message('Tests disabled (use debug build or -Dbuild_tests=true to enable)')
|
||||||
|
endif
|
||||||
@@ -2,3 +2,8 @@ option('usb_trace_only',
|
|||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
value: false,
|
value: false,
|
||||||
description: 'Enable USB trace mode: log USB data without sending to device (saves label tape during debugging)')
|
description: 'Enable USB trace mode: log USB data without sending to device (saves label tape during debugging)')
|
||||||
|
|
||||||
|
option('build_tests',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false,
|
||||||
|
description: 'Build unit tests (automatically enabled for debug builds)')
|
||||||
|
|||||||
@@ -108,7 +108,12 @@ else
|
|||||||
echo -e "${YELLOW}Warning: Coverage is only supported for debug builds, ignoring --coverage${NC}"
|
echo -e "${YELLOW}Warning: Coverage is only supported for debug builds, ignoring --coverage${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${BLUE}Building release version${NC}"
|
if [[ "${RUN_TESTS}" == true ]]; then
|
||||||
|
echo -e "${YELLOW}Warning: Tests are not built for release builds (use debug build for testing)${NC}"
|
||||||
|
RUN_TESTS=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${BLUE}Building release version (tests disabled)${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup or reconfigure build directory
|
# Setup or reconfigure build directory
|
||||||
|
|||||||
Reference in New Issue
Block a user