@@ -27,26 +27,37 @@ function build() {
2727 tag=" $1 "
2828 shift
2929
30- if [ -z " ${variant} " ]; then
31- full_tag=" ${tag} "
32- path=" ${version} /${variant} "
33- elif [ " ${variant} " = " default" ]; then
34- full_tag=" ${tag} "
35- path=" ${version} "
36- else
37- full_tag=" ${tag} -${variant} "
38- path=" ${version} /${variant} "
39- fi
30+ full_tag=$( get_full_tag " ${variant} " " ${tag} " )
31+ path=$( get_path " ${version} " " ${variant} " )
4032
4133 info " Building ${full_tag} ..."
4234
4335 if ! docker build --cpuset-cpus=" 0,1" -t node:" ${full_tag} " " ${path} " ; then
4436 fatal " Build of ${full_tag} failed!"
4537 fi
4638 info " Build of ${full_tag} succeeded."
39+ }
40+
41+ function test_image() {
42+ local full_version
43+ local variant
44+ local tag
45+ local full_tag
46+ full_version=" $1 "
47+ shift
48+ variant=" $1 "
49+ shift
50+ tag=" $1 "
51+ shift
52+
53+ full_tag=$( get_full_tag " ${variant} " " ${tag} " )
4754
4855 info " Testing ${full_tag} "
49- docker run --rm -v " $PWD /test-image.sh:/usr/local/bin/test.sh" node:" ${full_tag} " test.sh " ${full_version} "
56+ (
57+ export full_version=${full_version}
58+ export full_tag=${full_tag}
59+ bats test-image.bats
60+ )
5061}
5162
5263cd " $( cd " ${0%/* } " && pwd -P) " || exit
@@ -66,6 +77,7 @@ for version in "${versions[@]}"; do
6677 # Required for chakracore
6778 if [ -f " ${version} /Dockerfile" ]; then
6879 build " ${version} " " default" " ${tag} "
80+ test_image " ${full_version} " " default" " ${tag} "
6981 fi
7082
7183 # Get supported variants according to the target architecture.
@@ -78,9 +90,11 @@ for version in "${versions[@]}"; do
7890
7991 if [ " ${variant} " = " onbuild" ]; then
8092 build " ${version} " " ${default_variant} " " $tag "
93+ test_image " ${full_version} " " ${default_variant} " " $tag "
8194 fi
8295
8396 build " ${version} " " ${variant} " " ${tag} "
97+ test_image " ${full_version} " " ${variant} " " ${tag} "
8498 done
8599
86100done
0 commit comments