File tree Expand file tree Collapse file tree 1 file changed +29
-5
lines changed Expand file tree Collapse file tree 1 file changed +29
-5
lines changed Original file line number Diff line number Diff line change 13
13
14
14
# Set this to pass additional commandline flags to the go compiler, e.g. "make test EXTRAGOARGS=-v"
15
15
EXTRAGOARGS: =
16
+ DISABLE_ROOT_TESTS? =1
17
+
18
+ # The below files are needed and can be downloaded from the internet
19
+ testdata_objects = testdata/vmlinux testdata/root-drive.img testdata/firecracker
20
+
21
+ # --location is needed to follow redirects on github.com
22
+ curl = curl --location
16
23
17
24
all : build
18
25
19
26
test : all-tests
20
27
21
- unit-tests :
22
- go test -short ./... $(EXTRAGOARGS )
28
+ unit-tests : $( testdata_objects ) check-kvm
29
+ DISABLE_ROOT_TESTS= $( DISABLE_ROOT_TESTS ) go test -short ./... $(EXTRAGOARGS )
23
30
24
- all-tests :
25
- go test ./... $(EXTRAGOARGS )
31
+ all-tests : $(testdata_objects ) check-kvm
32
+ DISABLE_ROOT_TESTS=$(DISABLE_ROOT_TESTS ) go test ./... $(EXTRAGOARGS )
33
+
34
+ check-kvm :
35
+ @test -w /dev/kvm || \
36
+ (echo " In order to run firecracker, $( shell whoami) must have write permission to /dev/kvm" ; false)
26
37
27
38
generate build clean :
28
39
go $@ $(EXTRAGOARGS )
29
40
30
- .PHONY : all generate clean build test unit-tests all-tests
41
+ distclean : clean
42
+ rm -rf $(testdata_objects )
43
+
44
+ testdata/vmlinux :
45
+ $(curl ) -o $@ https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin
46
+
47
+ testdata/firecracker :
48
+ $(curl ) -o $@ https://github.com/firecracker-microvm/firecracker/releases/download/v0.18.0/firecracker-v0.18.0
49
+ chmod +x $@
50
+
51
+ testdata/root-drive.img :
52
+ $(curl ) -o $@ https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4
53
+
54
+ .PHONY : all generate clean distclean build test unit-tests all-tests check-kvm
You can’t perform that action at this time.
0 commit comments