aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/build/preprocess/Decomposed.in7
-rw-r--r--test/build/preprocess/Error.in5
-rw-r--r--test/build/preprocess/common3
-rw-r--r--test/build/preprocess/install-base3
-rw-r--r--test/test_podman_build.sh80
5 files changed, 71 insertions, 27 deletions
diff --git a/test/build/preprocess/Decomposed.in b/test/build/preprocess/Decomposed.in
new file mode 100644
index 000000000..a532176c8
--- /dev/null
+++ b/test/build/preprocess/Decomposed.in
@@ -0,0 +1,7 @@
+FROM alpine:latest
+
+#include "common"
+
+RUNHELLO
+
+#include "install-base"
diff --git a/test/build/preprocess/Error.in b/test/build/preprocess/Error.in
new file mode 100644
index 000000000..282ae5f9e
--- /dev/null
+++ b/test/build/preprocess/Error.in
@@ -0,0 +1,5 @@
+FROM alpine:latest
+
+#include "common"
+
+#error
diff --git a/test/build/preprocess/common b/test/build/preprocess/common
new file mode 100644
index 000000000..15c34f807
--- /dev/null
+++ b/test/build/preprocess/common
@@ -0,0 +1,3 @@
+#define RUNHELLO RUN echo "Hello world!"
+
+RUN touch /etc/hello-world.txt
diff --git a/test/build/preprocess/install-base b/test/build/preprocess/install-base
new file mode 100644
index 000000000..105a323c5
--- /dev/null
+++ b/test/build/preprocess/install-base
@@ -0,0 +1,3 @@
+RUN apk update
+
+RUN apk add git curl
diff --git a/test/test_podman_build.sh b/test/test_podman_build.sh
index a595e52c0..9faefc78a 100644
--- a/test/test_podman_build.sh
+++ b/test/test_podman_build.sh
@@ -16,9 +16,9 @@
HOME=`pwd`
-########
-# test "build-from-scratch"
-########
+echo ########################################################
+echo test "build-from-scratch"
+echo ########################################################
TARGET=scratch-image
podman build -q=True -t $TARGET $HOME/test/build/from-scratch
CID=$(buildah from $TARGET)
@@ -33,9 +33,9 @@ HOME=`pwd`
podman images -q
-########
-# test "build-preserve-subvolumes"
-########
+echo ########################################################
+echo test "build-preserve-subvolumes"
+echo ########################################################
TARGET=volume-image
podman build -t $TARGET $HOME/test/build/preserve-volumes
CID=$(buildah from $TARGET)
@@ -50,9 +50,9 @@ HOME=`pwd`
podman rmi $(buildah --debug=false images -q)
buildah --debug=false images -q
-########
-# test "build-git-context"
-########
+echo ########################################################
+echo test "build-git-context"
+echo ########################################################
TARGET=giturl-image
# Any repo should do, but this one is small and is FROM: scratch.
GITREPO=git://github.com/projectatomic/nulecule-library
@@ -63,9 +63,9 @@ HOME=`pwd`
podman images -q
-########
-# test "build-github-context"
-########
+echo ########################################################
+echo test "build-github-context"
+echo ########################################################
TARGET=github-image
# Any repo should do, but this one is small and is FROM: scratch.
GITREPO=github.com/projectatomic/nulecule-library
@@ -77,9 +77,9 @@ HOME=`pwd`
podman images -q
-########
-# test "build-additional-tags"
-########
+echo ########################################################
+echo test "build-additional-tags"
+echo ########################################################
TARGET=scratch-image
TARGET2=another-scratch-image
TARGET3=so-many-scratch-images
@@ -95,9 +95,9 @@ HOME=`pwd`
podman images -q
-########
-# test "build-volume-perms"
-########
+echo ########################################################
+echo test "build-volume-perms"
+echo ########################################################
TARGET=volume-image
podman build -t $TARGET $HOME/test/build/volume-perms
CID=$(buildah from $TARGET)
@@ -110,9 +110,9 @@ HOME=`pwd`
podman images -q
-########
-# test "build-from-glob"
-########
+echo ########################################################
+echo test "build-from-glob"
+echo ########################################################
TARGET=alpine-image
podman build -t $TARGET -file Dockerfile2.glob $HOME/test/build/from-multiple-files
CID=$(buildah from $TARGET)
@@ -124,9 +124,9 @@ HOME=`pwd`
podman images -q
-########
-# test "build-from-multiple-files-one-from"
-########
+echo ########################################################
+echo test "build-from-multiple-files-one-from"
+echo ########################################################
TARGET=scratch-image
podman build -t $TARGET -file $HOME/test/build/from-multiple-files/Dockerfile1.scratch -file $HOME/test/build/from-multiple-files/Dockerfile2.nofrom
CID=$(buildah from $TARGET)
@@ -146,9 +146,9 @@ HOME=`pwd`
buildah --debug=false images -q
-########
-# test "build-from-multiple-files-two-froms"
-########
+echo ########################################################
+echo test "build-from-multiple-files-two-froms"
+echo ########################################################
TARGET=scratch-image
podman build -t $TARGET -file $HOME/test/build/from-multiple-files/Dockerfile1.scratch -file $HOME/test/build/from-multiple-files/Dockerfile2.withfrom
CID=$(buildah from $TARGET)
@@ -170,3 +170,29 @@ HOME=`pwd`
buildah rm $CID
podman rmi $(buildah --debug=false images -q)
buildah --debug=false images -q
+
+echo ########################################################
+echo test "build-from-multiple-files-two-froms" with "-f -"
+echo ########################################################
+ TARGET=scratch-image
+ cat $HOME/test/build/from-multiple-files/Dockerfile1.alpine | podman build -t ${TARGET} -file - -file Dockerfile2.withfrom $HOME/test/build/from-multiple-files
+ CID=$(buildah from $TARGET)
+ ROOT=$(buildah mount $CID)
+ cmp $ROOT/Dockerfile1 $HOME/test/build/from-multiple-files/Dockerfile1.alpine
+ cmp $ROOT/Dockerfile2.withfrom $HOME/test/build/from-multiple-files/Dockerfile2.withfrom
+ test -s $ROOT/etc/passwd
+ buildah rm $CID
+ podman rmi $(buildah --debug=false images -q)
+ buildah --debug=false images -q
+
+echo ########################################################
+echo test "build with preprocessor"
+echo ########################################################
+
+ target=alpine-image
+ podman build -q -t ${TARGET} -f Decomposed.in $HOME/test/build/preprocess
+ buildah --debug=false images
+ CID=$(buildah from $TARGET)
+ buildah rm $CID
+ podman rmi $(buildah --debug=false images -q)
+ buildah --debug=false images -q