File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,3 +154,11 @@ docker run --rm -it \
154154 -v unittesting-home:/root \
155155 unittesting-local run_tests --tests-dir tests --pattern test_example.py
156156```
157+
158+ ## ARM hosts (Apple Silicon, arm64 Linux)
159+
160+ On an ARM host, the launcher builds and runs a native arm64 image. The
161+ container installs the arm64 build of Sublime Text 4.
162+
163+ Runs under amd64 emulation (for example ` DOCKER_DEFAULT_PLATFORM=linux/amd64 ` )
164+ are not supported.
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33echo PACKAGE = $PACKAGE
4+ echo ARCHITECTURE = $( uname -m)
45
56set -e
67
@@ -84,6 +85,37 @@ write_package_dependency_marker() {
8485 printf ' %s\n' " $dependency_fingerprint " > " $DEPENDENCY_MARKER_DIR /$PACKAGE .sha256"
8586}
8687
88+ ensure_sublime_text_arch_matches () {
89+ # A cache volume created on a different architecture holds a Sublime Text
90+ # binary that cannot run here, and the bootstrap marker skips reinstall.
91+ local binary=" $HOME /sublime_text/sublime_text"
92+ [ -f " $binary " ] || return 0
93+
94+ local expected
95+ case " $( uname -m) " in
96+ x86_64) expected=3e ;;
97+ aarch64) expected=b7 ;;
98+ * ) return 0 ;;
99+ esac
100+
101+ # e_machine field of the ELF header (low byte, little-endian).
102+ local actual
103+ actual=$( od -An -tx1 -j18 -N1 " $binary " | tr -d ' \n' )
104+ if [ " $actual " != " $expected " ]; then
105+ local found
106+ case " $actual " in
107+ 3e) found=x86_64 ;;
108+ b7) found=aarch64 ;;
109+ * ) found=" unknown (ELF machine 0x$actual )" ;;
110+ esac
111+ echo " Error: the cache volume has a Sublime Text build for $found ," >&2
112+ echo " but this container runs on $( uname -m) ." >&2
113+ echo " Run ut-run-tests with --refresh-cache, or use a different cache volume." >&2
114+ exit 1
115+ fi
116+ }
117+
118+ ensure_sublime_text_arch_matches
87119sudo sh -e /etc/init.d/xvfb start
88120ensure_git_identity
89121ensure_ci_platform_compat
Original file line number Diff line number Diff line change 22set -euo pipefail
33
44SCRIPT_DIR=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " && pwd) "
5- exec python " $SCRIPT_DIR /run_tests.py" " $@ "
5+ PYTHON=" $( command -v python3 || command -v python) "
6+ exec " $PYTHON " " $SCRIPT_DIR /run_tests.py" " $@ "
Original file line number Diff line number Diff line change @@ -28,10 +28,13 @@ if [ -z $SUBLIME_TEXT_VERSION ]; then
2828fi
2929
3030if [ -z $SUBLIME_TEXT_ARCH ]; then
31- SUBLIME_TEXT_ARCH=x64
31+ case " $( uname -m) " in
32+ aarch64|arm64) SUBLIME_TEXT_ARCH=arm64 ;;
33+ * ) SUBLIME_TEXT_ARCH=x64 ;;
34+ esac
3235fi
3336
34- if [ $SUBLIME_TEXT_VERSION -ge 4 ] && [ " $SUBLIME_TEXT_ARCH " != " x64" ]; then
37+ if [ $SUBLIME_TEXT_VERSION -ge 4 ] && [ " $SUBLIME_TEXT_ARCH " != " x64" ] && [ " $SUBLIME_TEXT_ARCH " != " arm64 " ] ; then
3538 echo " wrong value of $SUBLIME_TEXT_ARCH for Sublime Text version $SUBLIME_TEXT_VERSION "
3639 exit 1
3740fi
132135 echo " installing sublime text $SUBLIME_TEXT_VERSION "
133136 for i in {1..20}; do
134137 if [ $SUBLIME_TEXT_VERSION -ge 4 ]; then
135- URL=$( curl -s " $STWEB " | sed -n ' s/.*href="\([^"]*_x64 \.tar\.xz\)".*/\1/p' )
138+ URL=$( curl -s " $STWEB " | sed -n " s/.*href=\ " \([^\ " ]*_ ${SUBLIME_TEXT_ARCH} \.tar\.xz\)\ " .*/\1/p" )
136139 else
137140 if [ " $SUBLIME_TEXT_ARCH " = " x64" ]; then
138141 URL=$( curl -s " $STWEB " | sed -n ' s/.*href="\([^"]*x64\.tar\.bz2\)".*/\1/p' )
You can’t perform that action at this time.
0 commit comments