summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-02-02 17:46:22 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-02-09 10:49:02 +0100
commit4b9d6bf989a9ae50fa8328bc87464d4cca78dd41 (patch)
tree113b3b89072a0e3feb6049e61011d5309fa452c5
parent48115e5c803a2c73d35d047a9a0d9b2ea1352e64 (diff)
downloadjustbuild-4b9d6bf989a9ae50fa8328bc87464d4cca78dd41.tar.gz
Add test for mixed boot strapping
-rw-r--r--test/bootstrap/TARGETS10
-rwxr-xr-xtest/bootstrap/test-mixed-bootstrap.sh84
2 files changed, 94 insertions, 0 deletions
diff --git a/test/bootstrap/TARGETS b/test/bootstrap/TARGETS
index f87cc1a5..ad9427ab 100644
--- a/test/bootstrap/TARGETS
+++ b/test/bootstrap/TARGETS
@@ -81,6 +81,16 @@
, "test": ["test-bootstrap-prebuilt.sh"]
, "deps": ["distro-bootstrap-deps", "staged-sources"]
}
+, "mixed-test":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["bootstrap-test-mixed"]
+ , "test": ["test-mixed-bootstrap.sh"]
+ , "deps":
+ [ "distro-bootstrap-deps"
+ , "staged-sources"
+ , ["@", "just-distfiles", "", "distdir"]
+ ]
+ }
, "TESTS":
{ "type": "install"
, "tainted": ["test"]
diff --git a/test/bootstrap/test-mixed-bootstrap.sh b/test/bootstrap/test-mixed-bootstrap.sh
new file mode 100755
index 00000000..32c887f4
--- /dev/null
+++ b/test/bootstrap/test-mixed-bootstrap.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+# Copyright 2023 Huawei Cloud Computing Technology Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+
+# Set paths
+
+export PATH=/bin:/usr/bin:$PATH
+
+readonly ORIG_LOCALBASE=`pwd`/LOCALBASE
+readonly LOCALBASE=${TMPDIR}/new-localbase
+readonly WRKSRC=`pwd`/srcs/just
+readonly WRKDIR=${TMPDIR}/work-just-bootstrap
+mkdir -p ${WRKDIR}
+readonly TESTDIR=${TMPDIR}/work-test
+mkdir -p ${TESTDIR}
+readonly TEST_BUILD_ROOT=${TMPDIR}/.just
+mkdir -p ${TEST_BUILD_ROOT}
+readonly TEST_OUT_DIR=${TMPDIR}/work-test-out
+mkdir -p ${TEST_OUT_DIR}
+readonly DISTDIR=${TMPDIR}/distdir
+mkdir -p "${DISTDIR}"
+
+# Set up local base, leaving out some dependencies
+
+cp -r "${ORIG_LOCALBASE}" "${LOCALBASE}"
+
+# - gsl-liste
+rm -rf "${LOCALBASE}/include/gsl-lite"
+cp distdir/0.37.0.tar.gz "${DISTDIR}"
+
+# - fmt
+rm -rf "${LOCALBASE}/include/fmt*"
+rm -rf "${LOCALBASE}/lib/libfmt*"
+cp distdir/fmt-9.1.0.zip "${DISTDIR}"
+
+# bootstrap command
+
+env LOCALBASE=${LOCALBASE} PACKAGE=YES NON_LOCAL_DEPS='["gsl-lite", "fmt"]' \
+ python3 ${WRKSRC}/bin/bootstrap.py ${WRKSRC} ${WRKDIR} ${DISTDIR}
+
+# Do some sanity checks with the binary
+
+JUST=${WRKDIR}/out/bin/just
+echo Bootstrap finished. Obtained ${JUST}
+
+echo
+${JUST} -h
+echo
+${JUST} version
+echo
+touch ${TESTDIR}/ROOT
+cat > ${TESTDIR}/TARGETS <<'EOF'
+{ "hello world":
+ { "type": "generic"
+ , "cmds": ["echo Hello World > out.txt"]
+ , "outs": ["out.txt"]
+ }
+, "":
+ { "type": "generic"
+ , "cmds": ["cat out.txt | tr a-z A-Z > final.txt"]
+ , "outs": ["final.txt"]
+ , "deps": ["hello world"]
+ }
+}
+EOF
+
+${JUST} install -o ${TEST_OUT_DIR} --workspace-root ${TESTDIR} --local-build-root ${TEST_BUILD_ROOT} '' ''
+
+grep HELLO ${TEST_OUT_DIR}/final.txt
+
+echo OK