File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,9 @@ fmt: ; $(info Running gofmt...) @ ## Run gofmt on all source files
139
139
image : | $(BASE ) ; $(info Building Docker image...) @ # # Build SR-IOV CNI docker image
140
140
@$(IMAGE_BUILDER ) build -t $(TAG ) -f $(DOCKERFILE ) $(CURDIR ) $(DOCKERARGS )
141
141
142
+ test-image : image
143
+ $Q $(BASE ) /images/image_test.sh $(IMAGE_BUILDER ) $(TAG )
144
+
142
145
# Misc
143
146
144
147
.PHONY : deps-update
Original file line number Diff line number Diff line change 6
6
# Set known directories.
7
7
CNI_BIN_DIR=" /host/opt/cni/bin"
8
8
SRIOV_BIN_FILE=" /usr/bin/sriov"
9
+ NO_SLEEP=0
9
10
10
11
# Give help text for parameters.
11
12
usage ()
@@ -18,6 +19,7 @@ usage()
18
19
printf " \t-h --help\n"
19
20
printf " \t--cni-bin-dir=%s\n" " $CNI_BIN_DIR "
20
21
printf " \t--sriov-bin-file=%s\n" " $SRIOV_BIN_FILE "
22
+ printf " \t--no-sleep\n"
21
23
}
22
24
23
25
# Parse parameters given as arguments to this script.
@@ -35,6 +37,9 @@ while [ "$1" != "" ]; do
35
37
--sriov-bin-file)
36
38
SRIOV_BIN_FILE=$VALUE
37
39
;;
40
+ --no-sleep)
41
+ NO_SLEEP=1
42
+ ;;
38
43
* )
39
44
/bin/echo " ERROR: unknown parameter \" $PARAM \" "
40
45
usage
57
62
# Copy file into proper place.
58
63
cp -f " $SRIOV_BIN_FILE " " $CNI_BIN_DIR "
59
64
65
+ if [ $NO_SLEEP -eq 1 ]; then
66
+ exit 0
67
+ fi
68
+
60
69
echo " Entering sleep... (success)"
61
70
trap : TERM INT
62
71
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -x
4
+
5
+ OCI_RUNTIME=$1
6
+ IMAGE_UNDER_TEST=$2
7
+
8
+ OUTPUT_DIR=$( mktemp -d)
9
+
10
+ " ${OCI_RUNTIME} " run -v " ${OUTPUT_DIR} :/out" " ${IMAGE_UNDER_TEST} " --cni-bin-dir=/out --no-sleep
11
+
12
+ if [ ! -e " ${OUTPUT_DIR} /sriov" ]; then
13
+ echo " Output file ${OUTPUT_DIR} /sriov not found"
14
+ exit 1
15
+ fi
16
+
17
+ if [ ! -s " ${OUTPUT_DIR} /sriov" ]; then
18
+ echo " Output file ${OUTPUT_DIR} /sriov is empty"
19
+ exit 1
20
+ fi
21
+
22
+ exit 0
You can’t perform that action at this time.
0 commit comments