|
31 | 31 | for f in mcpp.tar.gz cacert.pem termux_inner.sh; do adb push "$EMU/$f" /data/local/tmp/ >/dev/null; done |
32 | 32 | adb shell chmod 644 /data/local/tmp/mcpp.tar.gz /data/local/tmp/cacert.pem /data/local/tmp/termux_inner.sh |
33 | 33 | A=/data/data/com.termux/files |
| 34 | + # Launch Termux once so it installs its bootstrap ($PREFIX: bash, curl, |
| 35 | + # resolv.conf, termux-exec), which is what a real Termux session has. |
| 36 | + adb shell am start -n com.termux/com.termux.app.TermuxActivity 2>&1 | tail -1 |
| 37 | + for i in $(seq 1 60); do |
| 38 | + adb shell run-as com.termux ls $A/usr/bin/bash >/dev/null 2>&1 && break |
| 39 | + sleep 5 |
| 40 | + done |
| 41 | + say "- Termux bootstrap: $(adb shell run-as com.termux ls -l $A/usr/bin/bash 2>&1 | tr -d '\r')" |
34 | 42 | adb shell run-as com.termux sh -c "'mkdir -p $A/home $A/probe && cp /data/local/tmp/mcpp.tar.gz /data/local/tmp/cacert.pem /data/local/tmp/termux_inner.sh $A/probe/'" 2>&1 |
35 | 43 | adb shell run-as com.termux sh -c "'id; cat /proc/self/attr/current; echo; ls -la $A'" 2>&1 | tee -a "$LOGS/sandbox.txt" |
36 | | - # The bash in termux_inner.sh is not there without Termux's bootstrap; run it |
37 | | - # with the system sh, which handles everything the script uses. |
| 44 | + # A Termux session's environment, as the app sets it up for its shell. |
| 45 | + TENV="PREFIX=$A/usr HOME=$A/home TMPDIR=$A/usr/tmp PATH=$A/usr/bin LANG=en_US.UTF-8 LD_PRELOAD=$A/usr/lib/libtermux-exec.so" |
38 | 46 | start=$(date +%s) |
39 | | - timeout 5400 adb shell run-as com.termux sh -c \ |
40 | | - "'PROBE_OUT=$A/probe/out PROBE_TARBALL=$A/probe/mcpp.tar.gz PROBE_HOME=$A/home SSL_CERT_FILE=$A/probe/cacert.pem sh $A/probe/termux_inner.sh'" \ |
41 | | - 2>&1 | tee "$LOGS/inner.log" |
| 47 | + timeout 5400 adb shell run-as com.termux $A/usr/bin/env $TENV \ |
| 48 | + PROBE_OUT=$A/probe/out PROBE_TARBALL=$A/probe/mcpp.tar.gz PROBE_HOME=$A/home \ |
| 49 | + $A/usr/bin/sh $A/probe/termux_inner.sh 2>&1 | tee "$LOGS/inner.log" |
42 | 50 | say "- wall: $(( $(date +%s) - start )) s" |
43 | 51 | for f in first-build.log; do |
44 | 52 | adb shell run-as com.termux cat "$A/probe/out/$f" > "$LOGS/$f" 2>/dev/null |
|
47 | 55 | say '### sandbox' |
48 | 56 | say '```' |
49 | 57 | cat "$LOGS/sandbox.txt" >> "$S" |
50 | | - grep -E '^(ENV|UNAME|ID|HARDLINK|MCPP|TIMING)' "$LOGS/inner.log" >> "$S" |
| 58 | + grep -E '^(ENV|UNAME|ID|HARDLINK|MCPP|TIMING|XLINGS|STAGE)' "$LOGS/inner.log" >> "$S" |
51 | 59 | say '```' |
52 | 60 | say '### first run: key lines' |
53 | 61 | say '```' |
54 | | - grep -E 'First run|Resolving|Installing|Downloading|error|warning|hint|Finished|glibc|Can.t create' \ |
| 62 | + grep -E 'First run|Resolving|Resolved|Installing|Downloading|error|warning|hint|Finished|glibc|llvm|musl|Can.t create|did not complete' \ |
55 | 63 | "$LOGS/inner.log" | head -60 >> "$S" |
56 | 64 | say '```' |
57 | 65 | say '### plan stage timings' |
|
0 commit comments