Skip to content

Commit b6e0a74

Browse files
zLukastszumski
andauthored
ADD: debug unit tests (#26)
* add debug unitTests * Fix assert detected by UnitTests in Debug mode --------- Co-authored-by: Tomasz Szumski <[email protected]>
1 parent 6af6d79 commit b6e0a74

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

.github/workflows/base_build.yaml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
tests/scripts/parrallelUT.sh
7171
tests/scripts/
7272
73-
linux-unit-tests:
73+
linux-unit-tests-release:
7474
needs: linux-build
7575
runs-on: ['self-hosted', 'linux', 'x64', 'valgrind']
7676
timeout-minutes: 120
@@ -98,8 +98,36 @@ jobs:
9898
sudo chmod +x ${{ github.workspace }}/Bin/Release/*
9999
${{ github.workspace }}/tests/scripts/parrallelUT.sh ./SvtJpegxsUnitTests ${{ env.JOBS_NUM }}
100100
101+
linux-unit-tests-debug:
102+
needs: linux-build
103+
runs-on: ['self-hosted', 'linux', 'x64', 'valgrind']
104+
timeout-minutes: 120
105+
steps:
106+
- name: 'Harden Runner'
107+
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
108+
with:
109+
egress-policy: audit
110+
111+
- name: 'Setup: Install dependencies'
112+
run: |
113+
sudo apt-get update
114+
sudo apt-get -y install nasm
115+
- name: download build artifacts
116+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
117+
with:
118+
name: "${{ env.LINUX_ARTIFACTS }}"
119+
120+
- name: 'Unit tests: Debug'
121+
run: |
122+
echo "Number of processors: ${NPROC}"
123+
cd Bin/Debug/
124+
ls -l
125+
sudo chmod +x ${{ github.workspace }}/tests/scripts/parrallelUT.sh
126+
sudo chmod +x ${{ github.workspace }}/Bin/Debug/*
127+
${{ github.workspace }}/tests/scripts/parrallelUT.sh ./SvtJpegxsUnitTests ${{ env.JOBS_NUM }}
128+
101129
linux-unit-tests-valgrind:
102-
needs: linux-unit-tests
130+
needs: linux-build
103131
runs-on: ['self-hosted', 'linux', 'x64', 'valgrind']
104132
timeout-minutes: 120
105133
steps:
@@ -134,7 +162,7 @@ jobs:
134162
${{ github.workspace }}/tests/scripts/parrallelUT.sh ./SvtJpegxsUnitTests ${{ env.JOBS_NUM }} valgrind
135163
136164
linux-conformance-tests:
137-
needs: linux-unit-tests-valgrind
165+
needs: linux-build
138166
runs-on: ['self-hosted', 'linux', 'x64', 'valgrind']
139167
timeout-minutes: 120
140168
steps:
@@ -162,7 +190,7 @@ jobs:
162190
./ParallelAllTests.sh ${{ env.JOBS_NUM }} ${INPUT_FILES_PATH} ${DEC_BIN_DIR}/SvtJpegxsDecApp
163191
env:
164192
DEC_BIN_DIR: ${{ github.workspace }}/Bin/Release
165-
INPUT_FILES_PATH: /opt/samples/Samples/ConformanceTestDecoder/
193+
INPUT_FILES_PATH: /opt/samples
166194

167195
windows-build:
168196
needs: changes

Source/Lib/Decoder/Codec/Packing.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ SvtJxsErrorType_t unpack_precinct(bitstream_reader_t* bitstream, precinct_t* pre
713713
subpkt_len_bytes = bitstream_reader_get_used_bytes(bitstream) - len_before_subpkt_bytes;
714714
if (subpkt_len_bytes != (pkt_header.gcli_len)) {
715715
int32_t leftover = (int32_t)pkt_header.gcli_len - subpkt_len_bytes;
716-
if (leftover > 0) {
716+
if (leftover > 0 && bitstream_reader_is_enough_bytes(bitstream, leftover)) {
717717
if (verbose >= VERBOSE_WARNINGS) {
718718
fprintf(stderr, "WARNING: (GCLI) skipped=%d\n", leftover);
719719
}
@@ -768,7 +768,7 @@ SvtJxsErrorType_t unpack_precinct(bitstream_reader_t* bitstream, precinct_t* pre
768768
subpkt_len_bytes = bitstream_reader_get_used_bytes(bitstream) - len_before_subpkt_bytes;
769769
if (subpkt_len_bytes != (pkt_header.data_len)) {
770770
int32_t leftover = (int32_t)pkt_header.data_len - subpkt_len_bytes;
771-
if (leftover > 0) {
771+
if (leftover > 0 && bitstream_reader_is_enough_bytes(bitstream, leftover)) {
772772
if (verbose >= VERBOSE_WARNINGS) {
773773
fprintf(stderr, "WARNING: (DATA) skipped=%d\n", leftover);
774774
}
@@ -816,7 +816,7 @@ SvtJxsErrorType_t unpack_precinct(bitstream_reader_t* bitstream, precinct_t* pre
816816
subpkt_len_bytes = bitstream_reader_get_used_bytes(bitstream) - len_before_subpkt_bytes;
817817
if (subpkt_len_bytes != ((uint32_t)pkt_header.sign_len)) {
818818
int32_t leftover = (int32_t)pkt_header.sign_len - subpkt_len_bytes;
819-
if (leftover > 0) {
819+
if (leftover > 0 && bitstream_reader_is_enough_bytes(bitstream, leftover)) {
820820
if (verbose >= VERBOSE_WARNINGS) {
821821
fprintf(stderr, "WARNING: (SIGN) skipped=%d\n", leftover);
822822
}

0 commit comments

Comments
 (0)