diff --git a/test/freeze_thaw/README b/test/freeze_thaw/README new file mode 100644 index 00000000..ff4f370c --- /dev/null +++ b/test/freeze_thaw/README @@ -0,0 +1,26 @@ +========== +How to run +========== + +(1) cd /test/freeze_thaw/cmd +(2) CPPFLAGS="-I../../../../ihk/linux/include -I../../../../ihk/linux/include/ihk" make +(3) cd /test/freeze_thaw +(4) sh run.sh + +============ +What to test +============ +check the freeze-thaw behavior. + + 000.sh: transition RUNNING state to FREEZE state + 001.sh: transition FREEZE state to RUNNING state + 002.sh: allow freeze request in FREEZE state + 003.sh: multiple freeze requests can be canceled with one thaw + 004.sh: multiple freeze requests can be canceled with one thaw + 005.sh: allow thaw request in RUNNING state + 100-147.sh: check the can't be create process in the frozen state(cpu#0-cpu#47) + 200.sh: parallel execution of freeze-thaw requests and fork system call + 300.sh: parallel execution of freeze-thaw requests and pthread create + +-- +README COPYRIGHT FUJITSU LIMITED 2019 \ No newline at end of file diff --git a/test/freeze_thaw/cmd/Makefile b/test/freeze_thaw/cmd/Makefile new file mode 100644 index 00000000..8143239d --- /dev/null +++ b/test/freeze_thaw/cmd/Makefile @@ -0,0 +1,25 @@ +# Makefile COPYRIGHT FUJITSU LIMITED 2019 +CC=$(CROSS_COMPILE)gcc +CPPFLAGS:=$(CPPFLAGS) -I/usr/local/include/ihk -I/usr/local/include/ihk +CFLAGS:=-O0 -ggdb3 -Wall +LDFLAGS:= + +all: helloworld fork pthread_create freeze thaw + +helloworld: helloworld.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) helloworld.c -o helloworld + +fork: fork.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) fork.c -o fork + +pthread_create: pthread_create.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -lpthread pthread_create.c -o pthread_create + +freeze: freeze.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) freeze.c -o freeze + +thaw: thaw.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) thaw.c -o thaw + +clean: + rm -rf helloworld fork pthread_create freeze thaw diff --git a/test/freeze_thaw/cmd/fork.c b/test/freeze_thaw/cmd/fork.c new file mode 100644 index 00000000..cac16a30 --- /dev/null +++ b/test/freeze_thaw/cmd/fork.c @@ -0,0 +1,54 @@ +/* fork.c COPYRIGHT FUJITSU LIMITED 2019 */ +#include +#include +#include +#include +#include +#include + +static void waitChildren(void) +{ + for (;;) { + int status = 0; + pid_t pid = wait(&status); + + if (pid == -1) { + const char msg[] = "wait fail\n"; + + if (errno == ECHILD) { + return; + } else if (errno == EINTR) { + continue; + } + write(STDERR_FILENO, msg, sizeof(msg)); + _exit(-1); + } + } +} + +int main(int argc, char **argv) +{ + int ret = 0; + int nr_fork; + int i; + + if (argc < 2) { + printf("usage: %s \n", argv[0]); + return 1; + } + nr_fork = atoi(argv[1]); + + for (i = 0; i < nr_fork; i++) { + pid_t pid = fork(); + + if (pid < 0) { + perror("fork"); + ret = -1; + break; + } else if (pid == 0) { + exit(0); + } + } + waitChildren(); + return ret; +} diff --git a/test/freeze_thaw/cmd/freeze.c b/test/freeze_thaw/cmd/freeze.c new file mode 100644 index 00000000..dbb0191a --- /dev/null +++ b/test/freeze_thaw/cmd/freeze.c @@ -0,0 +1,44 @@ +/* freeze.c COPYRIGHT FUJITSU LIMITED 2019 */ +#include +#include +#include +#include +#include +#include +#include +#include "ihk_host_user.h" + +int main(int argc, char **argv) +{ + int ret = 0; + int fd = -1; + char dev[128]; + int mcosid; + + if (argc < 2) { + printf("usage %s \n", argv[0]); + ret = -1; + goto out; + } + mcosid = atoi(argv[1]); + + sprintf(dev, "/dev/mcos%d", mcosid); + fd = open(dev, O_RDWR); + if (fd == -1) { + perror("open /dev/mcosN"); + ret = -1; + goto out; + } + + ret = ioctl(fd, IHK_OS_FREEZE, 0); + if (ret) { + perror("ioctl(freeze)"); + ret = -1; + goto out; + } +out: + if (fd != -1) { + close(fd); + } + return ret; +} diff --git a/test/freeze_thaw/cmd/helloworld.c b/test/freeze_thaw/cmd/helloworld.c new file mode 100644 index 00000000..203daf7d --- /dev/null +++ b/test/freeze_thaw/cmd/helloworld.c @@ -0,0 +1,15 @@ +#include +#include + +int main(int argc, char **argv) +{ + int num; + + if (argc < 2) { + printf("usage: %s \n", argv[0]); + return 1; + } + num = atoi(argv[1]); + printf("hello world[%d]\n", num); + return 0; +} diff --git a/test/freeze_thaw/cmd/pthread_create.c b/test/freeze_thaw/cmd/pthread_create.c new file mode 100644 index 00000000..85501ea4 --- /dev/null +++ b/test/freeze_thaw/cmd/pthread_create.c @@ -0,0 +1,49 @@ +/* pthread_create.c COPYRIGHT FUJITSU LIMITED 2019 */ +#include +#include +#include +#include + +#define MAX_THREAD 1000 +static pthread_t thread[MAX_THREAD]; + +static void *child_thread(void *arg) +{ + return NULL; +} + +int main(int argc, char **argv) +{ + int ret = 0; + int nr_thread; + int i, j; + + if (argc < 2) { + printf("usage: %s \n", argv[0]); + return 1; + } + + nr_thread = atoi(argv[1]); + if (nr_thread >= MAX_THREAD) { + printf("err: MAX_THREAD=%d\n", MAX_THREAD); + return 1; + } + + for (i = 0; i < nr_thread; i++) { + ret = pthread_create(&thread[i], NULL, child_thread, NULL); + if (ret) { + perror("pthread_create"); + break; + } + } + + for (j = 0; j < i; j++) { + int join = pthread_join(thread[j], NULL); + + if (join) { + ret = join; + perror("pthread_join"); + } + } + return ret; +} diff --git a/test/freeze_thaw/cmd/thaw.c b/test/freeze_thaw/cmd/thaw.c new file mode 100644 index 00000000..2135c55c --- /dev/null +++ b/test/freeze_thaw/cmd/thaw.c @@ -0,0 +1,44 @@ +/* thaw.c COPYRIGHT FUJITSU LIMITED 2019 */ +#include +#include +#include +#include +#include +#include +#include +#include "ihk_host_user.h" + +int main(int argc, char **argv) +{ + int ret = 0; + int fd = -1; + char dev[128]; + int mcosid; + + if (argc < 2) { + printf("usage %s \n", argv[0]); + ret = -1; + goto out; + } + mcosid = atoi(argv[1]); + + sprintf(dev, "/dev/mcos%d", mcosid); + fd = open(dev, O_RDWR); + if (fd == -1) { + perror("open /dev/mcosN"); + ret = -1; + goto out; + } + + ret = ioctl(fd, IHK_OS_THAW, 0); + if (ret) { + perror("ioctl(thaw)"); + ret = -1; + goto out; + } +out: + if (fd != -1) { + close(fd); + } + return ret; +} diff --git a/test/freeze_thaw/function b/test/freeze_thaw/function new file mode 100644 index 00000000..3f48df0e --- /dev/null +++ b/test/freeze_thaw/function @@ -0,0 +1,45 @@ +#!/bin/env bash +# function COPYRIGHT FUJITSU LIMITED 2019 +this_script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +cmd_dir="$(cd "$this_script_dir/cmd"; pwd)" +mkdir -p "$this_script_dir/work" +work_dir="$(cd "$this_script_dir/work"; pwd)" + +mcexec="$this_script_dir/mcexec" +hello="$cmd_dir/helloworld" +fork="$cmd_dir/fork" +thread="$cmd_dir/pthread_create" + +is_os_freeze() +{ + local status=`"$this_script_dir/ihkosctl" 0 get status` + if [ "$status" = "FROZEN" ]; then + return 0 + fi + return 1 +} + +is_os_running() +{ + local status=`"$this_script_dir/ihkosctl" 0 get status` + if [ "$status" = "RUNNING" ]; then + return 0 + fi + return 1 +} + +freeze() +{ + sudo "$cmd_dir/freeze" 0 + local ret=$? + sleep 1 + return $ret +} + +thaw() +{ + sudo "$cmd_dir/thaw" 0 + local ret=$? + sleep 1 + return $ret +} diff --git a/test/freeze_thaw/result.log b/test/freeze_thaw/result.log new file mode 100644 index 00000000..29d05d8c --- /dev/null +++ b/test/freeze_thaw/result.log @@ -0,0 +1,128 @@ +========================= +aarch64 +========================= +% sh run.sh +mcstop+release.sh ... done +mcreboot.sh -c 12-59 -m 2048M@4,2048M@5,2048M@6,2048M@7 -q 60 ... done +@@@ ./000.sh @@@ +OK +@@@ ./001.sh @@@ +OK +@@@ ./002.sh @@@ +OK +@@@ ./003.sh @@@ +OK +@@@ ./004.sh @@@ +OK +@@@ ./005.sh @@@ +hello world[0] +OK +@@@ ./100.sh @@@ +OK +@@@ ./101.sh @@@ +OK +@@@ ./102.sh @@@ +OK +@@@ ./103.sh @@@ +OK +@@@ ./104.sh @@@ +OK +@@@ ./105.sh @@@ +OK +@@@ ./106.sh @@@ +OK +@@@ ./107.sh @@@ +OK +@@@ ./108.sh @@@ +OK +@@@ ./109.sh @@@ +OK +@@@ ./110.sh @@@ +OK +@@@ ./111.sh @@@ +OK +@@@ ./112.sh @@@ +OK +@@@ ./113.sh @@@ +OK +@@@ ./114.sh @@@ +OK +@@@ ./115.sh @@@ +OK +@@@ ./116.sh @@@ +OK +@@@ ./117.sh @@@ +OK +@@@ ./118.sh @@@ +OK +@@@ ./119.sh @@@ +OK +@@@ ./120.sh @@@ +OK +@@@ ./121.sh @@@ +OK +@@@ ./122.sh @@@ +OK +@@@ ./123.sh @@@ +OK +@@@ ./124.sh @@@ +OK +@@@ ./125.sh @@@ +OK +@@@ ./126.sh @@@ +OK +@@@ ./127.sh @@@ +OK +@@@ ./128.sh @@@ +OK +@@@ ./129.sh @@@ +OK +@@@ ./130.sh @@@ +OK +@@@ ./131.sh @@@ +OK +@@@ ./132.sh @@@ +OK +@@@ ./133.sh @@@ +OK +@@@ ./134.sh @@@ +OK +@@@ ./135.sh @@@ +OK +@@@ ./136.sh @@@ +OK +@@@ ./137.sh @@@ +OK +@@@ ./138.sh @@@ +OK +@@@ ./139.sh @@@ +OK +@@@ ./140.sh @@@ +OK +@@@ ./141.sh @@@ +OK +@@@ ./142.sh @@@ +OK +@@@ ./143.sh @@@ +OK +@@@ ./144.sh @@@ +OK +@@@ ./145.sh @@@ +OK +@@@ ./146.sh @@@ +OK +@@@ ./147.sh @@@ +OK +@@@ ./200.sh @@@ +freeze-thaw: +.................... +./200.sh: line 43: 40002 Terminated sh "$script_dir/200_fork.sh" +OK +@@@ ./300.sh @@@ +freeze-thaw: +.................... +./300.sh: line 43: 55710 Terminated sh "$script_dir/300_thread.sh" +OK + +-- +result.log COPYRIGHT FUJITSU LIMITED 2019 \ No newline at end of file diff --git a/test/freeze_thaw/result_apollo.log b/test/freeze_thaw/result_apollo.log new file mode 100644 index 00000000..cfb167ce --- /dev/null +++ b/test/freeze_thaw/result_apollo.log @@ -0,0 +1,128 @@ +========================= +aarch64(apollo) +========================= +$ sh run.sh +mcstop+release.sh ... done +mcreboot.sh -c 8-55 -m 4096M -q 60 ... done +@@@ ./000.sh @@@ +OK +@@@ ./001.sh @@@ +OK +@@@ ./002.sh @@@ +OK +@@@ ./003.sh @@@ +OK +@@@ ./004.sh @@@ +OK +@@@ ./005.sh @@@ +hello world[0] +OK +@@@ ./100.sh @@@ +OK +@@@ ./101.sh @@@ +OK +@@@ ./102.sh @@@ +OK +@@@ ./103.sh @@@ +OK +@@@ ./104.sh @@@ +OK +@@@ ./105.sh @@@ +OK +@@@ ./106.sh @@@ +OK +@@@ ./107.sh @@@ +OK +@@@ ./108.sh @@@ +OK +@@@ ./109.sh @@@ +OK +@@@ ./110.sh @@@ +OK +@@@ ./111.sh @@@ +OK +@@@ ./112.sh @@@ +OK +@@@ ./113.sh @@@ +OK +@@@ ./114.sh @@@ +OK +@@@ ./115.sh @@@ +OK +@@@ ./116.sh @@@ +OK +@@@ ./117.sh @@@ +OK +@@@ ./118.sh @@@ +OK +@@@ ./119.sh @@@ +OK +@@@ ./120.sh @@@ +OK +@@@ ./121.sh @@@ +OK +@@@ ./122.sh @@@ +OK +@@@ ./123.sh @@@ +OK +@@@ ./124.sh @@@ +OK +@@@ ./125.sh @@@ +OK +@@@ ./126.sh @@@ +OK +@@@ ./127.sh @@@ +OK +@@@ ./128.sh @@@ +OK +@@@ ./129.sh @@@ +OK +@@@ ./130.sh @@@ +OK +@@@ ./131.sh @@@ +OK +@@@ ./132.sh @@@ +OK +@@@ ./133.sh @@@ +OK +@@@ ./134.sh @@@ +OK +@@@ ./135.sh @@@ +OK +@@@ ./136.sh @@@ +OK +@@@ ./137.sh @@@ +OK +@@@ ./138.sh @@@ +OK +@@@ ./139.sh @@@ +OK +@@@ ./140.sh @@@ +OK +@@@ ./141.sh @@@ +OK +@@@ ./142.sh @@@ +OK +@@@ ./143.sh @@@ +OK +@@@ ./144.sh @@@ +OK +@@@ ./145.sh @@@ +OK +@@@ ./146.sh @@@ +OK +@@@ ./147.sh @@@ +OK +@@@ ./200.sh @@@ +freeze-thaw: +.................... +./200.sh: line 43: 54182 Terminated sh "$script_dir/200_fork.sh" +OK +@@@ ./300.sh @@@ +freeze-thaw: +.................... +./300.sh: line 43: 41656 Terminated sh "$script_dir/300_thread.sh" +OK + +-- +result_apollo.log COPYRIGHT FUJITSU LIMITED 2019 \ No newline at end of file diff --git a/test/freeze_thaw/run.sh b/test/freeze_thaw/run.sh new file mode 100644 index 00000000..11574fa3 --- /dev/null +++ b/test/freeze_thaw/run.sh @@ -0,0 +1,18 @@ +#!/bin/env bash +# run.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../common.sh" +ln -sf "$BIN/mcexec" +ln -sf "$SBIN/ihkosctl" + +cd "$script_dir/tp" +for tp in `find . -regex './[0-9][0-9][0-9]\.sh$'` +do + echo "@@@ $tp @@@" + sh "$tp" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "NG" + fi +done diff --git a/test/freeze_thaw/tp/000.sh b/test/freeze_thaw/tp/000.sh new file mode 100644 index 00000000..2404cdb4 --- /dev/null +++ b/test/freeze_thaw/tp/000.sh @@ -0,0 +1,37 @@ +#!/bin/env bash +# 000.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# run +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change" + exit 1 +fi + +# +# check +# +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen" + exit 1 +fi + +# +# fin +# +thaw +exit 0 diff --git a/test/freeze_thaw/tp/001.sh b/test/freeze_thaw/tp/001.sh new file mode 100644 index 00000000..b1537a56 --- /dev/null +++ b/test/freeze_thaw/tp/001.sh @@ -0,0 +1,42 @@ +#!/bin/env bash +# 001.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change(freeze)" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen" + exit 1 +fi + +# +# run +# +thaw +if [ $? -ne 0 ]; then + echo "error: os status change(thaw)" + exit 1 +fi + +# +# check +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# fin +# +exit 0 diff --git a/test/freeze_thaw/tp/002.sh b/test/freeze_thaw/tp/002.sh new file mode 100644 index 00000000..c94af2c5 --- /dev/null +++ b/test/freeze_thaw/tp/002.sh @@ -0,0 +1,34 @@ +#!/bin/env bash +# 002.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen" + exit 1 +fi + +# +# run +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change" + exit 1 +fi + +# +# fin +# +thaw +exit 0 diff --git a/test/freeze_thaw/tp/003.sh b/test/freeze_thaw/tp/003.sh new file mode 100644 index 00000000..84bad490 --- /dev/null +++ b/test/freeze_thaw/tp/003.sh @@ -0,0 +1,55 @@ +#!/bin/env bash +# 003.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change(freeze):1" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen:1" + exit 1 +fi + +freeze +if [ $? -ne 0 ]; then + echo "error: os status change(freeze):2" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen:2" + exit 1 +fi + + +# +# run +# +thaw +if [ $? -ne 0 ]; then + echo "error: os status change(thaw)" + exit 1 +fi + +# +# check +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# fin +# +exit 0 diff --git a/test/freeze_thaw/tp/004.sh b/test/freeze_thaw/tp/004.sh new file mode 100644 index 00000000..0a1239b6 --- /dev/null +++ b/test/freeze_thaw/tp/004.sh @@ -0,0 +1,66 @@ +#!/bin/env bash +# 004.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change:1" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen:1" + exit 1 +fi + +freeze +if [ $? -ne 0 ]; then + echo "error: os status change(freeze):2" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen:2" + exit 1 +fi + +freeze +if [ $? -ne 0 ]; then + echo "error: os status change(freeze):3" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen:3" + exit 1 +fi + +# +# run +# +thaw +if [ $? -ne 0 ]; then + echo "error: os status change(thaw)" + exit 1 +fi + +# +# check +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# fin +# +exit 0 diff --git a/test/freeze_thaw/tp/005.sh b/test/freeze_thaw/tp/005.sh new file mode 100644 index 00000000..214b6be4 --- /dev/null +++ b/test/freeze_thaw/tp/005.sh @@ -0,0 +1,33 @@ +#!/bin/env bash +# 005.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# run +# +thaw +if [ $? -ne 0 ]; then + echo "error: os status change(thaw)" + exit 1 +fi + +"$mcexec" 0 "$hello" 0 +if [ $? -ne 0 ]; then + echo "error: execute user program" + exit 1 +fi + +# +# fin +# +exit 0 diff --git a/test/freeze_thaw/tp/100.sh b/test/freeze_thaw/tp/100.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/100.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/101.sh b/test/freeze_thaw/tp/101.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/101.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/102.sh b/test/freeze_thaw/tp/102.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/102.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/103.sh b/test/freeze_thaw/tp/103.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/103.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/104.sh b/test/freeze_thaw/tp/104.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/104.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/105.sh b/test/freeze_thaw/tp/105.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/105.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/106.sh b/test/freeze_thaw/tp/106.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/106.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/107.sh b/test/freeze_thaw/tp/107.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/107.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/108.sh b/test/freeze_thaw/tp/108.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/108.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/109.sh b/test/freeze_thaw/tp/109.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/109.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/110.sh b/test/freeze_thaw/tp/110.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/110.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/111.sh b/test/freeze_thaw/tp/111.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/111.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/112.sh b/test/freeze_thaw/tp/112.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/112.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/113.sh b/test/freeze_thaw/tp/113.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/113.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/114.sh b/test/freeze_thaw/tp/114.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/114.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/115.sh b/test/freeze_thaw/tp/115.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/115.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/116.sh b/test/freeze_thaw/tp/116.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/116.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/117.sh b/test/freeze_thaw/tp/117.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/117.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/118.sh b/test/freeze_thaw/tp/118.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/118.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/119.sh b/test/freeze_thaw/tp/119.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/119.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/120.sh b/test/freeze_thaw/tp/120.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/120.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/121.sh b/test/freeze_thaw/tp/121.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/121.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/122.sh b/test/freeze_thaw/tp/122.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/122.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/123.sh b/test/freeze_thaw/tp/123.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/123.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/124.sh b/test/freeze_thaw/tp/124.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/124.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/125.sh b/test/freeze_thaw/tp/125.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/125.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/126.sh b/test/freeze_thaw/tp/126.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/126.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/127.sh b/test/freeze_thaw/tp/127.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/127.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/128.sh b/test/freeze_thaw/tp/128.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/128.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/129.sh b/test/freeze_thaw/tp/129.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/129.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/130.sh b/test/freeze_thaw/tp/130.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/130.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/131.sh b/test/freeze_thaw/tp/131.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/131.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/132.sh b/test/freeze_thaw/tp/132.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/132.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/133.sh b/test/freeze_thaw/tp/133.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/133.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/134.sh b/test/freeze_thaw/tp/134.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/134.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/135.sh b/test/freeze_thaw/tp/135.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/135.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/136.sh b/test/freeze_thaw/tp/136.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/136.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/137.sh b/test/freeze_thaw/tp/137.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/137.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/138.sh b/test/freeze_thaw/tp/138.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/138.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/139.sh b/test/freeze_thaw/tp/139.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/139.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/140.sh b/test/freeze_thaw/tp/140.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/140.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/141.sh b/test/freeze_thaw/tp/141.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/141.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/142.sh b/test/freeze_thaw/tp/142.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/142.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/143.sh b/test/freeze_thaw/tp/143.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/143.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/144.sh b/test/freeze_thaw/tp/144.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/144.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/145.sh b/test/freeze_thaw/tp/145.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/145.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/146.sh b/test/freeze_thaw/tp/146.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/146.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/147.sh b/test/freeze_thaw/tp/147.sh new file mode 120000 index 00000000..d7f2fff7 --- /dev/null +++ b/test/freeze_thaw/tp/147.sh @@ -0,0 +1 @@ +1xx.sh \ No newline at end of file diff --git a/test/freeze_thaw/tp/1xx.sh b/test/freeze_thaw/tp/1xx.sh new file mode 100644 index 00000000..796b54f7 --- /dev/null +++ b/test/freeze_thaw/tp/1xx.sh @@ -0,0 +1,57 @@ +#!/bin/env bash +# 1xx.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" +tp_num=`basename $0 .sh` +cpu=$(($tp_num - 100)) + +# +# init +# +freeze +if [ $? -ne 0 ]; then + echo "error: os status change" + exit 1 +fi + +is_os_freeze +if [ $? -ne 0 ]; then + echo "error: os status is not frozen" + exit 1 +fi + +log="$work_dir/${cpu}.txt" +elog="$work_dir/${cpu}.err.txt" +rm -f "$log" "$elog" + +# +# run +# +"$mcexec" -c "$cpu" 0 "$hello" "$cpu" >"$log" 2>"$elog" & +sleep 1 + +string=`cat "$log"` +if [ -n "$string" ]; then + echo "error: log file is not empty:1" + exit 1 +fi + +thaw +sleep 1 + +string=`cat "$log"` +if [ -n "$string" ]; then + echo "error: log file is not empty:2" + exit 1 +fi + +grep -q "prepare: Resource temporarily unavailable" "$elog" +if [ $? -ne 0 ]; then + echo "error: unexpected errno" + exit 1 +fi + +# +# fin +# +exit 0 diff --git a/test/freeze_thaw/tp/200.sh b/test/freeze_thaw/tp/200.sh new file mode 100644 index 00000000..6cfa3533 --- /dev/null +++ b/test/freeze_thaw/tp/200.sh @@ -0,0 +1,44 @@ +#!/bin/env bash +# 200.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# run +# +sh "$script_dir/200_fork.sh"& +fork_pid=$! + +echo "freeze-thaw:" +for i in `seq 1 20` +do + echo -n "." + freeze + if [ $? -ne 0 ]; then + echo "error: freeze($i)" + exit 1 + fi + + thaw + if [ $? -ne 0 ]; then + echo "error: thaw($i)" + exit 1 + fi +done +echo "" + +# +# fin +# +kill $fork_pid +sleep 1 +exit 0 diff --git a/test/freeze_thaw/tp/200_fork.sh b/test/freeze_thaw/tp/200_fork.sh new file mode 100644 index 00000000..08cb3633 --- /dev/null +++ b/test/freeze_thaw/tp/200_fork.sh @@ -0,0 +1,9 @@ +#!/bin/env bash +# 200_fork.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +while true +do + "$mcexec" 0 "$fork" 100 >/dev/null 2>&1 +done diff --git a/test/freeze_thaw/tp/300.sh b/test/freeze_thaw/tp/300.sh new file mode 100644 index 00000000..515cb9e2 --- /dev/null +++ b/test/freeze_thaw/tp/300.sh @@ -0,0 +1,44 @@ +#!/bin/env bash +# 300.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +# +# init +# +is_os_running +if [ $? -ne 0 ]; then + echo "error: os status is not running" + exit 1 +fi + +# +# run +# +sh "$script_dir/300_thread.sh"& +sh_pid=$! + +echo "freeze-thaw:" +for i in `seq 1 20` +do + echo -n "." + freeze + if [ $? -ne 0 ]; then + echo "error: freeze($i)" + exit 1 + fi + + thaw + if [ $? -ne 0 ]; then + echo "error: thaw($i)" + exit 1 + fi +done +echo "" + +# +# fin +# +kill $sh_pid +sleep 1 +exit 0 diff --git a/test/freeze_thaw/tp/300_thread.sh b/test/freeze_thaw/tp/300_thread.sh new file mode 100644 index 00000000..3b7c7a3c --- /dev/null +++ b/test/freeze_thaw/tp/300_thread.sh @@ -0,0 +1,9 @@ +#!/bin/env bash +# 300_thread.sh COPYRIGHT FUJITSU LIMITED 2019 +script_dir="$(cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; pwd)" +. "$script_dir/../function" + +while true +do + "$mcexec" 0 "$thread" 100 >/dev/null 2>&1 +done