@@ -55,12 +55,19 @@ jobs:
5555 #
5656 SUITE_LOG_FILE="${path_GNU_tests}/test-suite.log"
5757 ROOT_SUITE_LOG_FILE="${path_GNU_tests}/test-suite-root.log"
58+ SELINUX_SUITE_LOG_FILE="${path_GNU_tests}/selinux-test-suite.log"
59+ SELINUX_ROOT_SUITE_LOG_FILE="${path_GNU_tests}/selinux-test-suite-root.log"
5860 TEST_LOGS_GLOB="${path_GNU_tests}/**/*.log" ## note: not usable at bash CLI; [why] double globstar not enabled by default b/c MacOS includes only bash v3 which doesn't have double globstar support
5961 TEST_FILESET_PREFIX='test-fileset-IDs.sha1#'
6062 TEST_FILESET_SUFFIX='.txt'
6163 TEST_SUMMARY_FILE='gnu-result.json'
6264 TEST_FULL_SUMMARY_FILE='gnu-full-result.json'
63- outputs SUITE_LOG_FILE ROOT_SUITE_LOG_FILE TEST_FILESET_PREFIX TEST_FILESET_SUFFIX TEST_LOGS_GLOB TEST_SUMMARY_FILE TEST_FULL_SUMMARY_FILE
65+ TEST_ROOT_FULL_SUMMARY_FILE='gnu-root-full-result.json'
66+ TEST_SELINUX_FULL_SUMMARY_FILE='selinux-gnu-full-result.json'
67+ TEST_SELINUX_ROOT_FULL_SUMMARY_FILE='selinux-root-gnu-full-result.json'
68+ AGGREGATED_SUMMARY_FILE='aggregated-result.json'
69+
70+ outputs SUITE_LOG_FILE ROOT_SUITE_LOG_FILE SELINUX_SUITE_LOG_FILE SELINUX_ROOT_SUITE_LOG_FILE TEST_FILESET_PREFIX TEST_FILESET_SUFFIX TEST_LOGS_GLOB TEST_SUMMARY_FILE TEST_FULL_SUMMARY_FILE TEST_ROOT_FULL_SUMMARY_FILE TEST_SELINUX_FULL_SUMMARY_FILE TEST_SELINUX_ROOT_FULL_SUMMARY_FILE AGGREGATED_SUMMARY_FILE
6471 - name : Checkout code (uutil)
6572 uses : actions/checkout@v4
6673 with :
8289 submodules : false
8390 persist-credentials : false
8491
92+ - name : Selinux - Setup Lima
93+ uses : lima-vm/lima-actions/setup@v1
94+ id : lima-actions-setup
95+
96+ - name : Selinux - Cache ~/.cache/lima
97+ uses : actions/cache@v4
98+ with :
99+ path : ~/.cache/lima
100+ key : lima-${{ steps.lima-actions-setup.outputs.version }}
101+
102+ - name : Selinux - Start Fedora VM with SELinux
103+ run : limactl start --plain --name=default --cpus=4 --disk=40 --memory=8 --network=lima:user-v2 template://fedora
104+
105+ - name : Selinux - Setup SSH
106+ uses : lima-vm/lima-actions/ssh@v1
107+
108+ - name : Selinux - Verify SELinux Status and Configuration
109+ run : |
110+ lima getenforce
111+ lima ls -laZ /etc/selinux
112+ lima sudo sestatus
113+
114+ # Ensure we're running in enforcing mode
115+ lima sudo setenforce 1
116+ lima getenforce
117+
118+ # Create test files with SELinux contexts for testing
119+ lima sudo mkdir -p /var/test_selinux
120+ lima sudo touch /var/test_selinux/test_file
121+ lima sudo chcon -t etc_t /var/test_selinux/test_file
122+ lima ls -Z /var/test_selinux/test_file # Verify context
123+
124+ - name : Selinux - Install dependencies in VM
125+ run : |
126+ lima sudo dnf -y update
127+ lima sudo dnf -y install git autoconf autopoint bison texinfo gperf gcc g++ gdb jq libacl-devel libattr-devel libcap-devel libselinux-devel attr rustup clang-devel texinfo-tex wget automake patch quilt
128+ lima rustup-init -y --default-toolchain stable
129+
85130 - name : Override submodule URL and initialize submodules
86131 # Use github instead of upstream git server
87132 run : |
@@ -125,55 +170,123 @@ jobs:
125170 sudo update-locale
126171 echo "After:"
127172 locale -a
173+
174+ - name : Selinux - Copy the sources to VM
175+ run : |
176+ rsync -a -e ssh . lima-default:~/work/
177+
128178 - name : Build binaries
129179 shell : bash
130180 run : |
131181 ## Build binaries
132182 cd '${{ steps.vars.outputs.path_UUTILS }}'
133183 bash util/build-gnu.sh --release-build
184+
185+ - name : Selinux - Generate selinux tests list
186+ run : |
187+ # Find and list all tests that require SELinux
188+ lima bash -c "cd ~/work/gnu/ && grep -l 'require_selinux_' -r tests/ > ~/work/uutils/selinux-tests.txt"
189+ lima bash -c "cd ~/work/uutils/ && cat selinux-tests.txt"
190+
191+ # Count the tests
192+ lima bash -c "cd ~/work/uutils/ && echo 'Found SELinux tests:'; wc -l selinux-tests.txt"
193+
194+ - name : Selinux - Build for selinux tests
195+ run : |
196+ lima bash -c "cd ~/work/uutils/ && bash util/build-gnu.sh"
197+ lima bash -c "mkdir -p ~/work/gnu/tests-selinux/"
198+
199+ - name : Selinux - Run selinux tests
200+ run : |
201+ lima sudo setenforce 1
202+ lima getenforce
203+ lima cat /proc/filesystems
204+ lima bash -c "cd ~/work/uutils/ && bash util/run-gnu-test.sh \$(cat selinux-tests.txt)"
205+
206+ - name : Selinux - Extract testing info from individual logs into JSON
207+ shell : bash
208+ run : |
209+ lima bash -c "cd ~/work/gnu/ && python3 ../uutils/util/gnu-json-result.py tests > ~/work/gnu/tests-selinux/${{ steps.vars.outputs.TEST_SELINUX_FULL_SUMMARY_FILE }}"
210+
211+ - name : Selinux/root - Run selinux tests
212+ run : |
213+ lima bash -c "cd ~/work/uutils/ && CI=1 bash util/run-gnu-test.sh run-root \$(cat selinux-tests.txt)"
214+
215+ - name : Selinux/root - Extract testing info from individual logs into JSON
216+ shell : bash
217+ run : |
218+ lima bash -c "cd ~/work/gnu/ && python3 ../uutils/util/gnu-json-result.py tests > ~/work/gnu/tests-selinux/${{ steps.vars.outputs.TEST_SELINUX_ROOT_FULL_SUMMARY_FILE }}"
219+
220+ - name : Selinux - Collect test logs and test results
221+ run : |
222+ mkdir -p ${{ steps.vars.outputs.path_GNU_tests }}-selinux
223+
224+ # Copy the test logs from the Lima VM to the host
225+ lima bash -c "cp ~/work/gnu/tests/test-suite.log ~/work/gnu/tests-selinux/ || echo 'No test-suite.log found'"
226+ lima bash -c "cp ~/work/gnu/tests/test-suite-root.log ~/work/gnu/tests-selinux/ || echo 'No test-suite-root.log found'"
227+ rsync -v -a -e ssh lima-default:~/work/gnu/tests-selinux/ ./${{ steps.vars.outputs.path_GNU_tests }}-selinux/
228+
229+ # Copy SELinux logs to the main test directory for integrated processing
230+ cp -f ${{ steps.vars.outputs.path_GNU_tests }}-selinux/test-suite.log ${{ steps.vars.outputs.path_GNU_tests }}/selinux-test-suite.log
231+ cp -f ${{ steps.vars.outputs.path_GNU_tests }}-selinux/test-suite-root.log ${{ steps.vars.outputs.path_GNU_tests }}/selinux-test-suite-root.log
232+ cp -f ${{ steps.vars.outputs.path_GNU_tests }}-selinux/${{ steps.vars.outputs.TEST_SELINUX_FULL_SUMMARY_FILE }} .
233+ cp -f ${{ steps.vars.outputs.path_GNU_tests }}-selinux/${{ steps.vars.outputs.TEST_SELINUX_ROOT_FULL_SUMMARY_FILE }} .
234+
134235 - name : Run GNU tests
135236 shell : bash
136237 run : |
137238 ## Run GNU tests
138239 path_GNU='${{ steps.vars.outputs.path_GNU }}'
139240 path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
140241 bash "${path_UUTILS}/util/run-gnu-test.sh"
242+
243+ - name : Extract testing info from individual logs into JSON
244+ shell : bash
245+ run : |
246+ path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
247+ python ${path_UUTILS}/util/gnu-json-result.py ${{ steps.vars.outputs.path_GNU_tests }} > ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}
248+
141249 - name : Run GNU root tests
142250 shell : bash
143251 run : |
144252 ## Run GNU root tests
145253 path_GNU='${{ steps.vars.outputs.path_GNU }}'
146254 path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
147255 bash "${path_UUTILS}/util/run-gnu-test.sh" run-root
148- - name : Extract testing info into JSON
256+
257+ - name : Extract testing info from individual logs (run as root) into JSON
149258 shell : bash
150259 run : |
151- ## Extract testing info into JSON
152260 path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
153- python ${path_UUTILS}/util/gnu-json-result.py ${{ steps.vars.outputs.path_GNU_tests }} > ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}
261+ python ${path_UUTILS}/util/gnu-json-result.py ${{ steps.vars.outputs.path_GNU_tests }} > ${{ steps.vars.outputs.TEST_ROOT_FULL_SUMMARY_FILE }}
262+
154263 - name : Extract/summarize testing info
155264 id : summary
156265 shell : bash
157266 run : |
158267 ## Extract/summarize testing info
159268 outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
160- #
269+
161270 path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
162- #
163- SUITE_LOG_FILE='${{ steps.vars.outputs.SUITE_LOG_FILE }}'
164- ROOT_SUITE_LOG_FILE='${{ steps.vars.outputs.ROOT_SUITE_LOG_FILE }}'
165- ls -al ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE}
166271
167- if test -f "${SUITE_LOG_FILE}"
272+ # Check if the file exists
273+ if test -f "${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}"
168274 then
169- source ${path_UUTILS}/util/analyze-gnu-results.sh ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE}
275+ # Look at all individual results and summarize
276+ eval $(python3 ${path_UUTILS}/util/analyze-gnu-results.py -o=${{ steps.vars.outputs.AGGREGATED_SUMMARY_FILE }} ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }} ${{ steps.vars.outputs.TEST_ROOT_FULL_SUMMARY_FILE }} ${{ steps.vars.outputs.TEST_SELINUX_FULL_SUMMARY_FILE }} ${{ steps.vars.outputs.TEST_SELINUX_ROOT_FULL_SUMMARY_FILE }})
277+
170278 if [[ "$TOTAL" -eq 0 || "$TOTAL" -eq 1 ]]; then
171- echo "::error ::Failed to parse test results from '${SUITE_LOG_FILE }'; failing early"
279+ echo "::error ::Failed to parse test results from '${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE } }'; failing early"
172280 exit 1
173281 fi
282+
174283 output="GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR / SKIP: $SKIP"
175284 echo "${output}"
176- if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then echo "::warning ::${output}" ; fi
285+
286+ if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then
287+ echo "::warning ::${output}"
288+ fi
289+
177290 jq -n \
178291 --arg date "$(date --rfc-email)" \
179292 --arg sha "$GITHUB_SHA" \
@@ -187,9 +300,10 @@ jobs:
187300 HASH=$(sha1sum '${{ steps.vars.outputs.TEST_SUMMARY_FILE }}' | cut --delim=" " -f 1)
188301 outputs HASH
189302 else
190- echo "::error ::Failed to find summary of test results (missing '${SUITE_LOG_FILE }'); failing early"
303+ echo "::error ::Failed to find summary of test results (missing '${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE } }'); failing early"
191304 exit 1
192305 fi
306+
193307 # Compress logs before upload (fails otherwise)
194308 gzip ${{ steps.vars.outputs.TEST_LOGS_GLOB }}
195309 - name : Reserve SHA1/ID of 'test-summary'
@@ -212,14 +326,38 @@ jobs:
212326 with :
213327 name : gnu-full-result.json
214328 path : ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}
329+ - name : Upload root json results
330+ uses : actions/upload-artifact@v4
331+ with :
332+ name : gnu-root-full-result.json
333+ path : ${{ steps.vars.outputs.TEST_ROOT_FULL_SUMMARY_FILE }}
334+ - name : Upload selinux json results
335+ uses : actions/upload-artifact@v4
336+ with :
337+ name : selinux-gnu-full-result.json
338+ path : ${{ steps.vars.outputs.TEST_SELINUX_FULL_SUMMARY_FILE }}
339+ - name : Upload selinux root json results
340+ uses : actions/upload-artifact@v4
341+ with :
342+ name : selinux-root-gnu-full-result.json
343+ path : ${{ steps.vars.outputs.TEST_SELINUX_ROOT_FULL_SUMMARY_FILE }}
344+ - name : Upload aggregated json results
345+ uses : actions/upload-artifact@v4
346+ with :
347+ name : aggregated-result.json
348+ path : ${{ steps.vars.outputs.AGGREGATED_SUMMARY_FILE }}
215349 - name : Compare test failures VS reference
216350 shell : bash
217351 run : |
218352 ## Compare test failures VS reference
219353 have_new_failures=""
220354 REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/test-suite.log'
221355 ROOT_REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/test-suite-root.log'
356+ SELINUX_REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/selinux-test-suite.log'
357+ SELINUX_ROOT_REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/selinux-test-suite-root.log'
222358 REF_SUMMARY_FILE='${{ steps.vars.outputs.path_reference }}/test-summary/gnu-result.json'
359+
360+
223361 REPO_DEFAULT_BRANCH='${{ steps.vars.outputs.repo_default_branch }}'
224362 path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
225363 # https://github.com/uutils/coreutils/issues/4294
0 commit comments