Commit 5571dc82 authored by Thomas Huth's avatar Thomas Huth Committed by Dr. David Alan Gilbert
Browse files

tests/migration: Enable the migration test on s390x, too



We can re-use the s390-ccw bios code to implement a small firmware
for a s390x guest which prints out the "A" and "B" characters and
modifies the memory, as required for the migration test.

[quintela: Converted the compile script to Makefile rules]
Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Message-Id: <1539078677-25396-1-git-send-email-thuth@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
  Fixed up Makefile since the aarch patch sneaked in first
parent c02b3781
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -416,6 +416,7 @@ check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
check-qtest-s390x-y += tests/migration-test$(EXESUF)

check-qtest-generic-y += tests/machine-none-test$(EXESUF)
check-qtest-generic-y += tests/qom-test$(EXESUF)
+24 −0
Original line number Diff line number Diff line
@@ -96,6 +96,17 @@ static void init_bootfile(const char *bootpath, void *content)
    fclose(bootfile);
}

#include "tests/migration/s390x/a-b-bios.h"

static void init_bootfile_s390x(const char *bootpath)
{
    FILE *bootfile = fopen(bootpath, "wb");
    size_t len = sizeof(s390x_elf);

    g_assert_cmpint(fwrite(s390x_elf, len, 1, bootfile), ==, 1);
    fclose(bootfile);
}

/*
 * Wait for some output in the serial output file,
 * we get an 'A' followed by an endless string of 'B's
@@ -443,6 +454,19 @@ static int test_migrate_start(QTestState **from, QTestState **to,
                                  accel, tmpfs, bootpath, uri);
        start_address = X86_TEST_MEM_START;
        end_address = X86_TEST_MEM_END;
    } else if (g_str_equal(arch, "s390x")) {
        init_bootfile_s390x(bootpath);
        cmd_src = g_strdup_printf("-machine accel=%s -m 128M"
                                  " -name source,debug-threads=on"
                                  " -serial file:%s/src_serial -bios %s",
                                  accel, tmpfs, bootpath);
        cmd_dst = g_strdup_printf("-machine accel=%s -m 128M"
                                  " -name target,debug-threads=on"
                                  " -serial file:%s/dest_serial -bios %s"
                                  " -incoming %s",
                                  accel, tmpfs, bootpath, uri);
        start_address = S390_TEST_MEM_START;
        end_address = S390_TEST_MEM_END;
    } else if (strcmp(arch, "ppc64") == 0) {
        cmd_src = g_strdup_printf("-machine accel=%s -m 256M -nodefaults"
                                  " -name source,debug-threads=on"
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
# See the COPYING file in the top-level directory.
#

TARGET_LIST = i386 aarch64
TARGET_LIST = i386 aarch64 s390x

SRC_PATH = ../..

+4 −0
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@
#define X86_TEST_MEM_START (1 * 1024 * 1024)
#define X86_TEST_MEM_END   (100 * 1024 * 1024)

/* S390 */
#define S390_TEST_MEM_START (1 * 1024 * 1024)
#define S390_TEST_MEM_END   (100 * 1024 * 1024)

/* PPC */
#define PPC_TEST_MEM_START (1 * 1024 * 1024)
#define PPC_TEST_MEM_END   (100 * 1024 * 1024)
+24 −0
Original line number Diff line number Diff line
# To specify cross compiler prefix, use CROSS_PREFIX=
#   $ make CROSS_PREFIX=s390x-linux-gnu-

.PHONY: all clean
all: a-b-bios.h
fwdir=../../../pc-bios/s390-ccw

CFLAGS+=-ffreestanding -fno-delete-null-pointer-checks -fPIE -Os \
	-msoft-float -march=z900 -fno-asynchronous-unwind-tables -Wl,-pie \
	-Wl,--build-id=none -nostdlib

a-b-bios.h: s390x.elf
	echo "$$__note" > header.tmp
	xxd -i $< | sed -e 's/.*int.*//' >> header.tmp
	mv header.tmp $@

# We use common-page-size=16 to avoid big padding in the ELF file
s390x.elf: a-b-bios.c
	$(CROSS_PREFIX)gcc $(CFLAGS) -I$(fwdir) $(fwdir)/start.S \
		$(fwdir)/sclp.c -Wl,-zcommon-page-size=16 -o $@ $<
	$(CROSS_PREFIX)strip $@

clean:
	@rm -rf *.elf *.o
Loading