Skip to content

Commit 69db5b9

Browse files
committed
Log cc1 calls instead of deleting cc1
1 parent e1555bd commit 69db5b9

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
apt-get update
4141
apt-get install --no-install-recommends -y -- "${prerequisites[@]}"
4242
shell: bash
43-
- name: Verify environment is sufficiently minimal for the test
43+
- name: Verify that we are in an environment with minimal dev tools
4444
run: |
4545
set -x
4646
for pattern in cmake g++ libssl-dev make pkgconf pkg-config; do
@@ -64,14 +64,32 @@ jobs:
6464
pattern='.*\b(-sys|cc|cmake|pkg-config|vcpkg)\b.*'
6565
! GREP_COLORS='ms=30;48;5;214' grep --color=always -Ex -C 1000000 -e "$pattern" tree.txt
6666
continue-on-error: true
67-
- name: Do max-pure build with minimal environment
68-
run: cargo install --debug --locked --no-default-features --features max-pure --path .
69-
- name: Clear target
70-
run: cargo clean
71-
- name: Break GCC's ability to compile C or C++
72-
run: find /usr/lib/gcc \( -name cc1 -o -name cc1plus \) -print -delete
73-
- name: Do max-pure build without being able to compile C or C++
67+
- name: Wrap cc1 (and cc1plus if present) to record calls
68+
run: |
69+
cat >/usr/local/bin/wrapper1 <<'EOF'
70+
#!/bin/sh
71+
printf '%s %s\n' "$0" "$*" >>/var/log/wrapper1.log
72+
exec "$0.orig" "$@"
73+
EOF
74+
75+
cat >/usr/local/bin/wrap1 <<'EOF'
76+
#!/bin/sh -e
77+
dir="$(dirname -- "$1")"
78+
base="$(basename -- "$1")"
79+
cd -- "$dir"
80+
mv -- "$base" "$base.orig"
81+
ln -s -- /usr/local/bin/wrapper1 "$base"
82+
EOF
83+
84+
chmod +x /usr/local/bin/wrap1 /usr/local/bin/wrapper1
85+
86+
find /usr/lib/gcc \( -name cc1 -o -name cc1plus \) \
87+
-print -exec /usr/local/bin/wrap1 {} \;
88+
- name: Build max-pure with minimal dev tools and log cc1
7489
run: cargo install --debug --locked --no-default-features --features max-pure --path .
90+
- name: Show logged C and C++ compilations (should be none)
91+
run: |
92+
! cat /var/log/wrapper1.log
7593
continue-on-error: true
7694

7795
test:

0 commit comments

Comments
 (0)