| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
TESTS = test.dmpstore.export \ |
| 7 |
test.efivar.export \ |
| 8 |
test.grubenv.var \ |
| 9 |
test.bootorder.var \ |
| 10 |
test.conin.var \ |
| 11 |
test.efivar.threading \ |
| 12 |
test.parse.db \ |
| 13 |
test.esl.annotation \ |
| 14 |
test.esl.sha256.unsorted \ |
| 15 |
test.esl.sha256.ascending \ |
| 16 |
test.esl.sha256.removal.descending \ |
| 17 |
test.esl.sha256.addition.unsorted \ |
| 18 |
test.esl.cert.addition \ |
| 19 |
test.esl.cert.removal |
| 20 |
|
| 21 |
all: clean $(TESTS) |
| 22 |
|
| 23 |
GRUB_PREFIX ?= grub2 |
| 24 |
VALGRIND ?= |
| 25 |
|
| 26 |
V ?= 0 |
| 27 |
ifeq ($(V),0) |
| 28 |
quiet=@ |
| 29 |
rmverbose= |
| 30 |
else |
| 31 |
quiet= |
| 32 |
rmverbose=-v |
| 33 |
endif |
| 34 |
ifeq ($(V),2) |
| 35 |
loud=-vvvv |
| 36 |
else |
| 37 |
loud= |
| 38 |
endif |
| 39 |
|
| 40 |
EFIVAR ?= $(VALGRIND) $(TOPDIR)/src/efivar $(loud) |
| 41 |
EFISECDB ?= $(VALGRIND) $(TOPDIR)/src/efisecdb $(loud) |
| 42 |
|
| 43 |
EFIVAR ?= $(VALGRIND) $(TOPDIR)/src/efivar $(loud) |
| 44 |
|
| 45 |
clean: |
| 46 |
$(quiet)rm $(rmverbose) -f test.*.result* \ |
| 47 |
test.esl.annotation.esl.result \ |
| 48 |
test.esl.cert.addition.esl.goal.txt \ |
| 49 |
test.esl.cert.removal.esl.goal.txt \ |
| 50 |
test.esl.sha256.addition.unsorted.esl.goal.txt \ |
| 51 |
test.esl.sha256.ascending.esl.goal.txt \ |
| 52 |
test.esl.sha256.removal.descending.esl.goal.txt \ |
| 53 |
test.esl.sha256.unsorted.esl.goal.txt |
| 54 |
|
| 55 |
test.dmpstore.export: |
| 56 |
$(quiet)echo testing export to DMPSTORE format |
| 57 |
$(quiet)$(GRUB_PREFIX)-editenv test.dmpstore.export.result.env create |
| 58 |
$(quiet)$(GRUB_PREFIX)-editenv test.dmpstore.export.result.env set debug=all,-scripting,-lexer |
| 59 |
$(quiet)truncate -s 512 test.dmpstore.export.result.env |
| 60 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.dmpstore.export.result.env -D -e test.dmpstore.export.result.var |
| 61 |
$(quiet)@if grep -q "Do not edit" test.dmpstore.export.result.env ; then \ |
| 62 |
cmp test.dmpstore.export.result.var test.dmpstore.export.new.goal.var ; \ |
| 63 |
else \ |
| 64 |
cmp test.dmpstore.export.result.var test.dmpstore.export.old.goal.var ; \ |
| 65 |
fi |
| 66 |
$(quiet)rm -f test.dmpstore.export.result.* |
| 67 |
$(quiet)echo passed |
| 68 |
|
| 69 |
test.efivar.export: |
| 70 |
$(quiet)echo testing export to libefivar format |
| 71 |
$(quiet)$(GRUB_PREFIX)-editenv test.efivar.export.result.env create |
| 72 |
$(quiet)$(GRUB_PREFIX)-editenv test.efivar.export.result.env set debug=all,-scripting,-lexer |
| 73 |
$(quiet)truncate -s 512 test.efivar.export.result.env |
| 74 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.efivar.export.result.env -e test.efivar.export.result.var |
| 75 |
$(quiet)if grep -q "Do not edit" test.efivar.export.result.env ; then \ |
| 76 |
cmp test.efivar.export.result.var test.efivar.export.new.goal.var ; \ |
| 77 |
else \ |
| 78 |
cmp test.efivar.export.result.var test.efivar.export.old.goal.var ; \ |
| 79 |
fi |
| 80 |
$(quiet)rm -f test.efivar.export.result.* |
| 81 |
$(quiet)echo passed |
| 82 |
|
| 83 |
test.grubenv.var: |
| 84 |
$(quiet)$(GRUB_PREFIX)-editenv test.grubenv.var.result.env create |
| 85 |
$(quiet)$(GRUB_PREFIX)-editenv test.grubenv.var.result.env set debug=all,-scripting,-lexer |
| 86 |
$(quiet)truncate -s 512 test.grubenv.var.result.env |
| 87 |
$(quiet)echo test importing from DMPSTORE and exporting to DMPSTORE and symbolic guid-name validation |
| 88 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.grubenv.var.result.env -D -e test.grubenv.var.0.export.var |
| 89 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.0.export.var -e test.grubenv.var.0.result.var -D |
| 90 |
$(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ |
| 91 |
cmp test.grubenv.var.0.result.var test.grubenv.var.0.new.goal.var ; \ |
| 92 |
else \ |
| 93 |
cmp test.grubenv.var.0.result.var test.grubenv.var.0.old.goal.var ; \ |
| 94 |
fi |
| 95 |
$(quiet)rm test.grubenv.var.0.result.* |
| 96 |
$(quiet)echo passed |
| 97 |
$(quiet)echo test importing from DMPSTORE and exporting to libefivar |
| 98 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.grubenv.var.result.env -D -e test.grubenv.var.1.export.var |
| 99 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.1.export.var -e test.grubenv.var.1.result.var |
| 100 |
$(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ |
| 101 |
cmp test.grubenv.var.1.result.var test.grubenv.var.1.new.goal.var ; \ |
| 102 |
else \ |
| 103 |
cmp test.grubenv.var.1.result.var test.grubenv.var.1.old.goal.var ; \ |
| 104 |
fi |
| 105 |
$(quiet)rm test.grubenv.var.1.result.* |
| 106 |
$(quiet)echo passed |
| 107 |
$(quiet)echo test importing from libefivar and exporting to DMPSTORE and mixed-case guid-name validation |
| 108 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n 91376aff-cBa6-42bE-949d-06fde81128e8-GRUB_ENV -f test.grubenv.var.result.env -e test.grubenv.var.2.export.var |
| 109 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.2.export.var -e test.grubenv.var.2.result.var -D |
| 110 |
$(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ |
| 111 |
cmp test.grubenv.var.2.result.var test.grubenv.var.2.new.goal.var ; \ |
| 112 |
else \ |
| 113 |
cmp test.grubenv.var.2.result.var test.grubenv.var.2.old.goal.var ; \ |
| 114 |
fi |
| 115 |
$(quiet)rm test.grubenv.var.2.result.* |
| 116 |
$(quiet)echo passed |
| 117 |
$(quiet)echo test importing from libefivar and exporting to libefivar and guid-name validation |
| 118 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n 91376aff-cba6-42be-949d-06fde81128e8-GRUB_ENV -f test.grubenv.var.result.env -e test.grubenv.var.3.export.var |
| 119 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.3.export.var -e test.grubenv.var.3.result.var |
| 120 |
$(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ |
| 121 |
cmp test.grubenv.var.3.result.var test.grubenv.var.3.new.goal.var ; \ |
| 122 |
else \ |
| 123 |
cmp test.grubenv.var.3.result.var test.grubenv.var.3.old.goal.var ; \ |
| 124 |
fi |
| 125 |
$(quiet)rm -f test.grubenv.var.3.result.* test.grubenv.var.result.env test.grubenv.var.3.goal.var |
| 126 |
$(quiet)echo passed |
| 127 |
$(quiet)echo testing efivar -L |
| 128 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -L | \ |
| 129 |
grep -q '^{91376aff-cba6-42be-949d-06fde81128e8} {grub} efi_guid_grub GRUB$$' |
| 130 |
$(quiet)echo passed |
| 131 |
|
| 132 |
test.bootorder.var: |
| 133 |
$(quiet)echo testing with BootOrder variable dmpstore generated |
| 134 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.bootorder.var.goal.var -e test.bootorder.var.0.result.var |
| 135 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.bootorder.var.0.result.var -e test.bootorder.var.1.result.var -D |
| 136 |
$(quiet)cmp test.bootorder.var.goal.var test.bootorder.var.1.result.var |
| 137 |
$(quiet)echo passed |
| 138 |
|
| 139 |
test.conin.var: |
| 140 |
$(quiet)echo testing with ConIn variable dmpstore generated |
| 141 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.conin.var.goal.var -e test.conin.var.0.result.var |
| 142 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.conin.var.0.result.var -e test.conin.var.1.result.var -D |
| 143 |
$(quiet)cmp test.conin.var.goal.var test.conin.var.1.result.var |
| 144 |
$(quiet)echo passed |
| 145 |
|
| 146 |
test.efivar.threading: |
| 147 |
$(quiet)echo testing threading in libefivar |
| 148 |
$(quiet)TOPDIR=$(TOPDIR) $(TOPDIR)/tests/test-threading |
| 149 |
|
| 150 |
test.esl.dump.x509.sha256: |
| 151 |
$(quiet)echo testing ESL dumping with x509 + sha256 sums |
| 152 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) \ |
| 153 |
-i test.esl.sha256.addition.unsorted.esl.goal -A > test.esl.dump.x509.sha256.result.txt |
| 154 |
$(quiet)cmp test.esl.dump.x509.sha256.goal.txt test.esl.sha256.addition.unsorted.result.txt |
| 155 |
$(quiet)echo passed |
| 156 |
|
| 157 |
%.goal.txt : %.goal |
| 158 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src ../src/efisecdb --dump --annotate \ |
| 159 |
-s none -i $< > $@ |
| 160 |
|
| 161 |
%.result.txt : %.result |
| 162 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src ../src/efisecdb --dump --annotate \ |
| 163 |
-s none -i $< > $@ |
| 164 |
|
| 165 |
%.var.result.txt : %.var |
| 166 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src ../src/efisecdb --dump --annotate \ |
| 167 |
-s none -i $< > $@ |
| 168 |
|
| 169 |
test.parse.db: test.parse.db.var.result.txt |
| 170 |
$(quiet)echo testing parsing db variable |
| 171 |
$(quiet)if ! cmp test.parse.db.var.goal.txt test.parse.db.var.result.txt ; then \ |
| 172 |
diff -U 200 test.parse.db.var.goal.txt test.parse.db.var.result.txt ; \ |
| 173 |
exit 1 ; \ |
| 174 |
fi |
| 175 |
$(quiet)echo passed |
| 176 |
|
| 177 |
test.esl.annotation.esl.result : test.esl.annotation.esl |
| 178 |
$(quiet)cp $(rmverbose) $< $@ |
| 179 |
|
| 180 |
test.esl.annotation: test.esl.annotation.esl.goal.txt |
| 181 |
test.esl.annotation: test.esl.annotation.esl.result.txt |
| 182 |
$(quiet)echo testing ESL annotation with x509 + sha256 sums |
| 183 |
$(quiet)if ! cmp [email protected] [email protected] ; then \ |
| 184 |
diff -U 200 [email protected] [email protected] ; \ |
| 185 |
exit 1 ; \ |
| 186 |
fi |
| 187 |
$(quiet)echo passed |
| 188 |
|
| 189 |
test.esl.sha256.unsorted.esl.result: |
| 190 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 -a \ |
| 191 |
-h 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 \ |
| 192 |
-h 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f \ |
| 193 |
-h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ |
| 194 |
-h 8d74beec1be996322ad76813bafb92d40839895d6dd7ee808b17ca201eac98be \ |
| 195 |
-s none -f -o $@ |
| 196 |
|
| 197 |
test.esl.sha256.unsorted: test.esl.sha256.unsorted.esl.result.txt test.esl.sha256.unsorted.esl.goal.txt |
| 198 |
$(quiet)echo testing ESL creation with sha256 sums '(unsorted)' |
| 199 |
$(quiet)if ! cmp [email protected] [email protected] ; then \ |
| 200 |
diff -U 200 [email protected] [email protected] ; \ |
| 201 |
exit 1 ; \ |
| 202 |
fi |
| 203 |
$(quiet)echo passed |
| 204 |
|
| 205 |
test.esl.sha256.ascending.esl.result: |
| 206 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 -a \ |
| 207 |
-h 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 \ |
| 208 |
-h 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f \ |
| 209 |
-h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ |
| 210 |
-h 8d74beec1be996322ad76813bafb92d40839895d6dd7ee808b17ca201eac98be \ |
| 211 |
-s data -s ascending -f -o $@ |
| 212 |
|
| 213 |
test.esl.sha256.ascending: test.esl.sha256.ascending.esl.goal.txt test.esl.sha256.ascending.esl.result.txt |
| 214 |
$(quiet)echo testing ESL creation with sha256 sums '(ascending)' |
| 215 |
$(quiet)if ! cmp [email protected] [email protected] ; then \ |
| 216 |
diff -U 200 [email protected] [email protected] ; \ |
| 217 |
exit 1 ; \ |
| 218 |
fi |
| 219 |
$(quiet)echo passed |
| 220 |
|
| 221 |
test.esl.sha256.removal.descending.esl.result: |
| 222 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ |
| 223 |
-i test.esl.sha256.unsorted.esl.goal -r \ |
| 224 |
-h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ |
| 225 |
-s data -s descending -f -o $@ |
| 226 |
|
| 227 |
test.esl.sha256.removal.descending: test.esl.sha256.removal.descending.esl.result.txt |
| 228 |
test.esl.sha256.removal.descending: test.esl.sha256.removal.descending.esl.goal.txt |
| 229 |
$(quiet)echo testing ESL entry removal with sha256 sums '(descending)' |
| 230 |
$(quiet)if ! cmp [email protected] [email protected] ; then \ |
| 231 |
diff -U 200 [email protected] [email protected] ; \ |
| 232 |
exit 1 ; \ |
| 233 |
fi |
| 234 |
$(quiet)echo passed |
| 235 |
|
| 236 |
test.esl.sha256.addition.unsorted.esl.result: |
| 237 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ |
| 238 |
-i test.esl.sha256.addition.unsorted.esl.goal -a \ |
| 239 |
-h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ |
| 240 |
-s none -f -o test.esl.sha256.addition.unsorted.esl.result |
| 241 |
|
| 242 |
test.esl.sha256.addition.unsorted: test.esl.sha256.addition.unsorted.esl.result.txt |
| 243 |
test.esl.sha256.addition.unsorted: test.esl.sha256.addition.unsorted.esl.goal.txt |
| 244 |
$(quiet)echo testing adding a sha256 sum to an existing ESL '(unsorted)' |
| 245 |
$(quiet)if ! cmp [email protected] [email protected] ; then \ |
| 246 |
diff -U 200 [email protected] [email protected] ; \ |
| 247 |
exit 1 ; \ |
| 248 |
fi |
| 249 |
$(quiet)echo passed |
| 250 |
|
| 251 |
test.esl.cert.addition.esl.result: |
| 252 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ |
| 253 |
-i test.esl.sha256.unsorted.esl.goal -a -c test.esl.cert.addition.cert.cer \ |
| 254 |
-f -o test.esl.cert.addition.esl.result |
| 255 |
|
| 256 |
test.esl.cert.addition: |
| 257 |
$(quiet)echo testing ESL entry addition with x509 cert |
| 258 |
$(quiet)$(MAKE) test.esl.cert.addition.esl.result.txt test.esl.cert.addition.esl.goal.txt |
| 259 |
$(quiet)if ! cmp test.esl.cert.addition.esl.goal test.esl.cert.addition.esl.result ; then \ |
| 260 |
diff -U 200 test.esl.cert.addition.esl.goal.txt test.esl.cert.addition.esl.result.txt ; \ |
| 261 |
exit 1 ; \ |
| 262 |
fi |
| 263 |
$(quiet)rm -f test.esl.cert.addition.esl.result test.esl.cert.addition.*.esl.txt |
| 264 |
$(quiet)echo passed |
| 265 |
|
| 266 |
test.esl.cert.removal.esl.goal.txt : test.esl.cert.removal.esl.goal |
| 267 |
|
| 268 |
test.esl.cert.removal.esl.result: |
| 269 |
$(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ |
| 270 |
-i test.esl.cert.addition.cert.esl.goal -r -c test.esl.cert.addition.cert.cer \ |
| 271 |
-f -o test.esl.cert.removal.esl.result |
| 272 |
|
| 273 |
test.esl.cert.removal: |
| 274 |
$(quiet)echo testing ESL entry removal with x509 cert |
| 275 |
$(quiet)$(MAKE) test.esl.cert.removal.esl.goal.txt test.esl.cert.removal.esl.result.txt |
| 276 |
$(quiet)if ! cmp test.esl.cert.removal.esl.goal test.esl.cert.removal.esl.result ; then \ |
| 277 |
diff -U 200 test.esl.cert.removal.esl.goal.txt test.esl.cert.removal.esl.result.txt ; \ |
| 278 |
exit 1 ; \ |
| 279 |
fi |
| 280 |
$(quiet)cmp test.esl.cert.removal.esl.goal test.esl.cert.removal.esl.result |
| 281 |
$(quiet)rm -f test.esl.cert.removal.esl.result |
| 282 |
$(quiet)echo passed |
| 283 |
|
| 284 |
.PHONY: all clean $(TESTS) |
| 285 |
|
| 286 |
|
| 287 |
|