Skip to content

Commit 590f71a

Browse files
committed
✨ putting in place the tests for the installer
1 parent 2932b7e commit 590f71a

8 files changed

Lines changed: 134 additions & 50 deletions

File tree

commands.d/self-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ function selfTest_runSingleTestSuite() {
412412
# the function test::fail was called
413413
# Can be reproduced by inserting a `test::fail` call in the test script.
414414
fs::readFile "${GLOBAL_TEST_LOG_FILE}"
415-
log::error "The test script ⌜${testScript##*/}⌝ at line ⌜${lineNumber}⌝ failed because an error was explicitly thrown in the test script:"$'\n\n'"${REPLY}"$'\n\n'"test::fail called in ⌜${testScript/#"${GLOBAL_PROGRAM_STARTED_AT_DIRECTORY}/"/}:${lineNumber}⌝."
415+
log::error "The test script ⌜${testScript##*/}⌝ at line ⌜${lineNumber}⌝ failed because an error was explicitly thrown in the test script:"$'\n\n'"${REPLY}"$'\n'"test::fail called in ⌜${testScript/#"${GLOBAL_PROGRAM_STARTED_AT_DIRECTORY}/"/}:${lineNumber}⌝."
416416
log::printCallStack stackToSkip=0 stackToSkipAtEnd=11
417417

418418
elif [[ ${scriptGotError} == "true" ]]; then

tests.d/install/01.install.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
# shellcheck source=../../libraries.d/lib-fs
4+
source fs
5+
6+
# cancel the test suite if not running on windows
7+
if ! command -v docker &>/dev/null; then
8+
test::skipTestSuite "This test suite is only runnable on systems with Docker installed, skipping it."
9+
fi
10+
11+
function main() {
12+
:
13+
}
14+
15+
main
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Test suite install
2+
3+
## Test script 01.install
4+
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
FROM debian:trixie AS bash-builder
2+
3+
SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c", "-x"]
4+
5+
ARG STANDARD_PACKAGES="locales ca-certificates curl build-essential wget devscripts"
6+
7+
RUN \
8+
apt-get update; \
9+
apt-get install -qq -y ${STANDARD_PACKAGES};
10+
11+
# build bash 5.0
12+
RUN \
13+
cd /tmp; \
14+
wget http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz; \
15+
tar xf bash-5.0.tar.gz; \
16+
cd bash-5.0; \
17+
export CFLAGS="-O2 -fpermissive"; \
18+
./configure; \
19+
make; \
20+
unset -v CFLAGS; \
21+
cp ./bash /usr/local/bin/bash-5.0; \
22+
cd /tmp; \
23+
rm -rf /tmp/*
24+
25+
# build bash 5.1
26+
RUN \
27+
cd /tmp; \
28+
wget http://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz; \
29+
tar xf bash-5.1.tar.gz; \
30+
cd bash-5.1; \
31+
export CFLAGS="-g -O2 -Wno-implicit-function-declaration -std=gnu11"; \
32+
./configure; \
33+
make; \
34+
unset -v CFLAGS; \
35+
cp ./bash /usr/local/bin/bash-5.1; \
36+
cd /tmp; \
37+
rm -rf /tmp/*
38+
39+
# build bash 5.2
40+
RUN \
41+
cd /tmp; \
42+
wget http://ftp.gnu.org/gnu/bash/bash-5.2.tar.gz; \
43+
tar xf bash-5.2.tar.gz; \
44+
cd bash-5.2; \
45+
export CFLAGS="-g -O2 -Wno-implicit-function-declaration -std=gnu11"; \
46+
./configure; \
47+
make; \
48+
unset -v CFLAGS; \
49+
cp ./bash /usr/local/bin/bash-5.2; \
50+
cd /tmp; \
51+
rm -rf /tmp/*
52+
53+
# build bash 5.3
54+
RUN \
55+
cd /tmp; \
56+
wget http://ftp.gnu.org/gnu/bash/bash-5.3.tar.gz; \
57+
tar xf bash-5.3.tar.gz; \
58+
cd bash-5.3; \
59+
./configure; \
60+
make; \
61+
cp ./bash /usr/local/bin/bash-5.3; \
62+
cd /tmp; \
63+
rm -rf /tmp/*
64+
65+
RUN \
66+
pushd /tmp; \
67+
curl -fsSL https://github.com/nushell/nushell/releases/download/0.111.0/nu-0.111.0-x86_64-unknown-linux-gnu.tar.gz -o nu.tar.gz; \
68+
tar -xvf nu.tar.gz; \
69+
mv nu-0.111.0-x86_64-unknown-linux-gnu/nu /usr/local/bin/nu; \
70+
curl -fsSL https://github.com/dandavison/delta/releases/download/0.19.1/delta-0.19.1-x86_64-unknown-linux-gnu.tar.gz -O; \
71+
tar -xvf delta-0.19.1-x86_64-unknown-linux-gnu.tar.gz; \
72+
mv delta-0.19.1-x86_64-unknown-linux-gnu/delta /usr/local/bin/delta; \
73+
popd; \
74+
rm -rf /tmp/*
75+
76+
77+
FROM debian:trixie-slim
78+
79+
SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c", "-x"]
80+
81+
ARG STANDARD_PACKAGES="locales ca-certificates curl git xonsh fish zsh csh tcsh ksh wget"
82+
83+
COPY --from=bash-builder /usr/local/bin /usr/local/bin
84+
85+
# ✅ install packages
86+
# ✅ set up locale
87+
ARG LOCALE=en_US
88+
ENV LANG=${LOCALE}.UTF-8
89+
ENV LC_ALL=${LOCALE}.UTF-8
90+
ENV LANGUAGE=${LOCALE}.UTF-8
91+
RUN \
92+
apt-get update; \
93+
apt-get install -qq -y ${STANDARD_PACKAGES}; \
94+
localedef -i ${LOCALE} -c -f UTF-8 -A /usr/share/locale/locale.alias ${LOCALE}.UTF-8; \
95+
echo "${LOCALE}.UTF-8 UTF-8" >> /etc/locale.gen; \
96+
echo "LANG=${LOCALE}.UTF-8" >> /etc/locale.conf; \
97+
locale-gen ${LOCALE}.UTF-8; \
98+
useradd -m -s /bin/bash me; \
99+
chmod a+x /usr/local/bin/*;
100+
101+
USER me
102+
WORKDIR /home/me
103+
ENTRYPOINT [ "/bin/bash" ]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
# docker build . -t valet-tests-slimdeb:latest --progress plain
4+
# docker tag valet-tests-slimdeb:latest noyacode/valet-tests-slimdeb:latest
5+
# docker push noyacode/valet-tests-slimdeb:latest
6+
7+
docker run --rm -it --entrypoint /usr/local/bin/bash-5.0 valet-tests-slimdeb:latest
8+
docker run --rm -it --entrypoint /usr/local/bin/bash-5.1 valet-tests-slimdeb:latest
9+
docker run --rm -it --entrypoint /usr/local/bin/bash-5.2 valet-tests-slimdeb:latest
10+
docker run --rm -it --entrypoint /usr/local/bin/bash-5.3 valet-tests-slimdeb:latest

tests.d/self-install/minideb-bash5.0/Dockerfile

Lines changed: 0 additions & 48 deletions
This file was deleted.

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.37.256
1+
0.37.258

0 commit comments

Comments
 (0)