On Mon, 11 Apr 2022 12:07:50 +0200 Nico Boehr <nrb@xxxxxxxxxxxxx> wrote: > Add a selftest to check we can do migration tests. > > Signed-off-by: Nico Boehr <nrb@xxxxxxxxxxxxx> > --- > s390x/Makefile | 1 + > s390x/selftest-migration.c | 27 +++++++++++++++++++++++++++ > s390x/unittests.cfg | 4 ++++ > 3 files changed, 32 insertions(+) > create mode 100644 s390x/selftest-migration.c > > diff --git a/s390x/Makefile b/s390x/Makefile > index 62e197cb93d7..2e43e323bcb5 100644 > --- a/s390x/Makefile > +++ b/s390x/Makefile > @@ -26,6 +26,7 @@ tests += $(TEST_DIR)/edat.elf > tests += $(TEST_DIR)/mvpg-sie.elf > tests += $(TEST_DIR)/spec_ex-sie.elf > tests += $(TEST_DIR)/firq.elf > +tests += $(TEST_DIR)/selftest-migration.elf > > pv-tests += $(TEST_DIR)/pv-diags.elf > > diff --git a/s390x/selftest-migration.c b/s390x/selftest-migration.c > new file mode 100644 > index 000000000000..8884322a84ca > --- /dev/null > +++ b/s390x/selftest-migration.c > @@ -0,0 +1,27 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Migration Selftest > + * > + * Copyright IBM Corp. 2022 > + * > + * Authors: > + * Nico Boehr <nrb@xxxxxxxxxxxxx> > + */ > +#include <libcflat.h> > + > +int main(void) > +{ > + /* don't say migrate here otherwise we will migrate right away */ > + report_prefix_push("selftest migration"); > + > + /* ask migrate_cmd to migrate (it listens for 'migrate') */ > + puts("Please migrate me\n"); > + > + /* wait for migration to finish, we will read a newline */ > + (void)getchar(); how hard would it be to actually check that you got the newline? > + > + report_pass("Migrated"); > + > + report_prefix_pop(); > + return report_summary(); > +} > diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg > index 1600e714c8b9..b0417a69705d 100644 > --- a/s390x/unittests.cfg > +++ b/s390x/unittests.cfg > @@ -24,6 +24,10 @@ groups = selftest > # please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile > extra_params = -append 'test 123' > > +[selftest-migration] > +file = selftest-migration.elf > +groups = selftest migration > + > [intercept] > file = intercept.elf >