File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # #===----------------------------------------------------------------------===##
3+ # #
4+ # # This source file is part of the SwiftContainerPlugin open source project
5+ # #
6+ # # Copyright (c) 2025 Apple Inc. and the SwiftContainerPlugin project authors
7+ # # Licensed under Apache License v2.0
8+ # #
9+ # # See LICENSE.txt for license information
10+ # # See CONTRIBUTORS.txt for the list of SwiftContainerPlugin project authors
11+ # #
12+ # # SPDX-License-Identifier: Apache-2.0
13+ # #
14+ # #===----------------------------------------------------------------------===##
15+
16+ #
17+ # This script assumes that the Static Linux SDK has already been installed
18+ #
19+
20+ log () { printf -- " ** %s\n" " $* " >&2 ; }
21+ error () { printf -- " ** ERROR: %s\n" " $* " >&2 ; }
22+ fatal () { error " $@ " ; exit 1; }
23+
24+ set -euo pipefail
25+
26+ RUNTIME=${RUNTIME-" docker" }
27+
28+ #
29+ # Create a test package
30+ #
31+ PKGPATH=$( mktemp -d)
32+ swift package --package-path " $PKGPATH " init --type executable --name hello
33+
34+ cleanup () {
35+ log " Deleting temporary package $PKGPATH "
36+ rm -rf " $PKGPATH "
37+ }
38+ trap cleanup EXIT
39+
40+ #
41+ # Build and package an aarch64 binary
42+ #
43+ swift build --package-path " $PKGPATH " --swift-sdk aarch64-swift-linux-musl
44+
45+ IMGREF=$( swift run containertool --repository localhost:5000/elf_test " $PKGPATH /.build/aarch64-swift-linux-musl/debug/hello" --from scratch --cmd " arg1" " --option" " opt" " --flag" )
46+ $RUNTIME pull " $IMGREF "
47+ CMD=$( $RUNTIME inspect " $IMGREF " --format " {{.Config.Cmd}}" )
48+ if [ " $CMD " = " [arg1 --option opt --flag]" ] ; then
49+ log " cmd option: PASSED"
50+ else
51+ fatal " cmd option: FAILED - cmd was $CMD ; expected [arg1 --option opt --flag]"
52+ fi
You can’t perform that action at this time.
0 commit comments