freeze: add freeze_thaw test

Change-Id: I31db80b89adca9ac354a96ad21073b269d8a0e24
This commit is contained in:
TOIDA,Suguru
2019-09-18 19:00:05 +09:00
committed by Masamichi Takagi
parent 83ade5cdcd
commit ec31d72483
70 changed files with 1054 additions and 0 deletions

26
test/freeze_thaw/README Normal file
View File

@ -0,0 +1,26 @@
==========
How to run
==========
(1) cd <mckernel>/test/freeze_thaw/cmd
(2) CPPFLAGS="-I../../../../ihk/linux/include -I../../../../ihk/linux/include/ihk" make
(3) cd <mckernel>/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

View File

@ -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

View File

@ -0,0 +1,54 @@
/* fork.c COPYRIGHT FUJITSU LIMITED 2019 */
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
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 <nr_fork>\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;
}

View File

@ -0,0 +1,44 @@
/* freeze.c COPYRIGHT FUJITSU LIMITED 2019 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#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 <osnum>\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;
}

View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int num;
if (argc < 2) {
printf("usage: %s <num>\n", argv[0]);
return 1;
}
num = atoi(argv[1]);
printf("hello world[%d]\n", num);
return 0;
}

View File

@ -0,0 +1,49 @@
/* pthread_create.c COPYRIGHT FUJITSU LIMITED 2019 */
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#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 <nr_thread>\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;
}

View File

@ -0,0 +1,44 @@
/* thaw.c COPYRIGHT FUJITSU LIMITED 2019 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#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 <osnum>\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;
}

45
test/freeze_thaw/function Normal file
View File

@ -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
}

128
test/freeze_thaw/result.log Normal file
View File

@ -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

View File

@ -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

18
test/freeze_thaw/run.sh Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

1
test/freeze_thaw/tp/100.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/101.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/102.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/103.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/104.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/105.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/106.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/107.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/108.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/109.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/110.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/111.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/112.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/113.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/114.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/115.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/116.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/117.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/118.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/119.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/120.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/121.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/122.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/123.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/124.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/125.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/126.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/127.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/128.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/129.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/130.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/131.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/132.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/133.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/134.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/135.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/136.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/137.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/138.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/139.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/140.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/141.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/142.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/143.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/144.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/145.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/146.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

1
test/freeze_thaw/tp/147.sh Symbolic link
View File

@ -0,0 +1 @@
1xx.sh

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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