x86 UEFI: Make _NO_FILE_4Uhere_ work w/ BOOTX64.EFI

The `_NO_FILE_4Uhere_` test case is used by the runner scripts to verify
QEMU's configuration. Make it work with EFI/BOOT/BOOTX64.EFI by compling
a minimal EFI binary, called dummy.c that returns immediately.

Signed-off-by: Marc Orr <marcorr@google.com>
Message-Id: <20211116204053.220523-11-zxwang42@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 228a207..bb89a53 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -132,7 +132,7 @@
 
     last_line=$(premature_failure > >(tail -1)) && {
         skip=true
-        if [ "${TARGET_EFI}" == "y" ] && [[ "${last_line}" =~ "Reset" ]]; then
+        if [ "${TARGET_EFI}" == "y" ] && [[ "${last_line}" =~ "enabling apic" ]]; then
             skip=false
         fi
         if [ ${skip} == true ]; then
diff --git a/x86/Makefile.common b/x86/Makefile.common
index 2b39dd5..984444e 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -72,7 +72,7 @@
 endif
 
 tests-common = $(TEST_DIR)/vmexit.$(exe) $(TEST_DIR)/tsc.$(exe) \
-               $(TEST_DIR)/smptest.$(exe)  \
+               $(TEST_DIR)/smptest.$(exe) $(TEST_DIR)/dummy.$(exe) \
                $(TEST_DIR)/msr.$(exe) \
                $(TEST_DIR)/hypercall.$(exe) $(TEST_DIR)/sieve.$(exe) \
                $(TEST_DIR)/kvmclock_test.$(exe) \
diff --git a/x86/dummy.c b/x86/dummy.c
new file mode 100644
index 0000000..5019e79
--- /dev/null
+++ b/x86/dummy.c
@@ -0,0 +1,4 @@
+int main(int argc, char **argv)
+{
+	return 0;
+}
diff --git a/x86/efi/run b/x86/efi/run
index a888979..ac368a5 100755
--- a/x86/efi/run
+++ b/x86/efi/run
@@ -29,6 +29,10 @@
 # Remove the TEST_CASE from $@
 shift 1
 
+if [ "$EFI_CASE" = "_NO_FILE_4Uhere_" ]; then
+	EFI_CASE=dummy
+fi
+
 # Prepare EFI boot file system
 #   - Copy .efi file to host dir $EFI_TEST/$EFI_CASE/EFI/BOOT/BOOTX64.EFI
 #     This host dir will be loaded by QEMU as a FAT32 image
@@ -37,9 +41,7 @@
 : "${EFI_CASE_BINARY:="$EFI_CASE_DIR/BOOTX64.EFI"}"
 
 mkdir -p "$EFI_CASE_DIR"
-if [ "$EFI_CASE" != "_NO_FILE_4Uhere_" ]; then
-	cp "$EFI_SRC/$EFI_CASE.efi" "$EFI_CASE_BINARY"
-fi
+cp "$EFI_SRC/$EFI_CASE.efi" "$EFI_CASE_BINARY"
 
 # Run test case with 256MiB QEMU memory. QEMU default memory size is 128MiB.
 # After UEFI boot up and we call `LibMemoryMap()`, the largest consecutive