Skip to content

Commit 35dda2a

Browse files
marc-hbkv2019i
authored andcommitted
.github/zephyr: compare Windows and Linux builds
The End. Signed-off-by: Marc Herbert <[email protected]>
1 parent 1193203 commit 35dda2a

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.github/workflows/zephyr.yml

+44
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,47 @@ jobs:
259259
path: |
260260
${{ github.workspace }}/workspace/build-sof-staging
261261
${{ github.workspace }}/workspace/**/compile_commands.json
262+
263+
264+
compare-linux-win:
265+
266+
runs-on: ubuntu-latest
267+
268+
# - We don't compare _all_ the builds, and
269+
# - even when some of the ones we compare fail, we still want to compare the rest.
270+
if: ${{ always() }}
271+
needs: [build-linux, build-windows]
272+
273+
steps:
274+
- uses: actions/checkout@v3
275+
# we need only one script but it's simpler to get the (last
276+
# revision of the) whole repo and it takes seconds.
277+
with:
278+
# Isolate the clone in a subdirectory to make sure globbing
279+
# does not catch random SOF files.
280+
path: ./sof
281+
282+
- name: Download Windows and Linux builds
283+
uses: actions/download-artifact@v3
284+
285+
- name: apt-get dos2unix
286+
run: sudo apt-get update; sudo apt-get -y install dos2unix
287+
288+
- name: Delete and fix expected differences
289+
run: |
290+
ls -l
291+
# run it twice to make sure it's idempotent
292+
for i in 0 1; do
293+
./sof/zephyr/scripts/clean-expected-release-differences.sh \
294+
windows-build* linux-build*
295+
done
296+
297+
- name: Compare Linux vs Windows builds
298+
run: |
299+
# FIXME: for windows the Z_SDK version is hardcoded above, for Linux it's not.
300+
diffs=0
301+
for windir in windows-build*; do
302+
lindir=linux-"${windir#windows-}"
303+
diff -qr "$lindir" "$windir" || : $((diffs++))
304+
done
305+
exit $diffs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
# shellcheck disable=SC3043
4+
5+
set -e
6+
7+
die()
8+
{
9+
# shellcheck disable=SC2059
10+
>&2 printf "$@"
11+
exit 1
12+
}
13+
14+
fix_dir()
15+
{
16+
local bd="$1"
17+
18+
test -d "$bd"/build-sof-staging ||
19+
die 'No %s/build-sof-staging directory\n' "$bd"
20+
21+
# config files have absolute paths
22+
find "$bd" -name 'config.gz' -exec rm '{}' \;
23+
24+
# In case of a compression timestamp. Also gives better messages.
25+
find "$bd" -name '*.gz' -print0 | xargs -r -0 gunzip
26+
27+
( set -x
28+
29+
# Native binaries
30+
rm -f "$bd"/build-sof-staging/tools/sof-logger*
31+
# Python and other scripts
32+
dos2unix "$bd"/build-sof-staging/tools/* || true
33+
34+
# signature salt
35+
find "$bd" -name '*.ri' -exec rm '{}' \;
36+
37+
# debug symbols
38+
find "$bd" -name main.mod -exec rm '{}' \;
39+
find "$bd" -name zephyr.elf -exec rm '{}' \;
40+
41+
# Unlike zephyr.lst, zephyr.map includes some debug information which is
42+
# as usual full of absolute paths, e.g.:
43+
# /opt/toolchains/zephyr-sdk-0.15.2/xtensa-intel_s1000_..../libgcc.a(_divsf3.o)
44+
# Delete non-reproducible information inside zephyr.map.
45+
find "$bd" -name zephyr.map -exec sed -i'' -e \
46+
's#[^[:blank:]]*zephyr-sdk-[^/]*/xtensa#ZSDK/xtensa#; s#\\#/#g; /^ \.debug_/ d' \
47+
'{}' \;
48+
49+
# The above search/replace normalizes MOST but unfortunately not
50+
# all the debug information! So let's delete zephyr.map after all :-(
51+
# Comparing "almost normalized" zephyr.map files can be very
52+
# useful to root cause differences: comment out this line in your
53+
# local workspace.
54+
find "$bd" -name zephyr.map -exec rm '{}' \;
55+
56+
find "$bd" -name 'compile_commands.json' -exec rm '{}' \;
57+
)
58+
59+
}
60+
61+
main()
62+
{
63+
for d in "$@"; do
64+
fix_dir "$d"
65+
done
66+
}
67+
68+
69+
main "$@"

0 commit comments

Comments
 (0)