Test "Wait for LWK to run at shutdown." on arm64
Change-Id: I96785dda7a1a7eb36ceeb31401d71b4e40efb185 Refs: #898 Refs: #928
This commit is contained in:
162
test/mng_mod/issues/898_928/arm64/CT_001.c
Normal file
162
test/mng_mod/issues/898_928/arm64/CT_001.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* CT_001.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_001";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_PARAM);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
goto shutdown;
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "mcexec\n");
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown immediately after boot returned 0\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
//OKNG(ret_ihklib == 0, "destroy immediately after boot\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
162
test/mng_mod/issues/898_928/arm64/CT_002.c
Normal file
162
test/mng_mod/issues/898_928/arm64/CT_002.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* CT_002.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_002";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
goto destroy;
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "mcexec\n");
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
//OKNG(ret_ihklib == 0, "shutdown immediately after boot\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
OKNG(ret_ihklib == 0, "destroy immediately after boot returned NOT 0\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
161
test/mng_mod/issues/898_928/arm64/CT_003.c
Normal file
161
test/mng_mod/issues/898_928/arm64/CT_003.c
Normal file
@ -0,0 +1,161 @@
|
||||
/* CT_003.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_003";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "done mcexec\n");
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown after mcexec returned 0\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
//OKNG(ret_ihklib == 0, "destroy immediately after boot\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
162
test/mng_mod/issues/898_928/arm64/CT_004.c
Normal file
162
test/mng_mod/issues/898_928/arm64/CT_004.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* CT_004.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_004";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "do mcexec\n");
|
||||
goto destroy;
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
//OKNG(ret_ihklib == 0, "shutdown after mcexec\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
OKNG(ret_ihklib == 0, "destroy after mcexec returned 0\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
170
test/mng_mod/issues/898_928/arm64/CT_005.c
Normal file
170
test/mng_mod/issues/898_928/arm64/CT_005.c
Normal file
@ -0,0 +1,170 @@
|
||||
/* CT_005.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_005";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib, pid;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
printf(" start long mcexec...\n");
|
||||
fflush(stdout);
|
||||
sprintf(cmd, "%s/bin/mcexec sleep 5", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
return 0;
|
||||
}
|
||||
sleep(2);
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown during mcexec returned 0\n");
|
||||
printf(" (But, mcexec process remain due to #846)\n");
|
||||
fflush(stdout);
|
||||
goto done_test;
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
//OKNG(ret_ihklib == 0, "destroy immediately after boot\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
done_test:
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
174
test/mng_mod/issues/898_928/arm64/CT_006.c
Normal file
174
test/mng_mod/issues/898_928/arm64/CT_006.c
Normal file
@ -0,0 +1,174 @@
|
||||
/* CT_006.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_006";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib, pid;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
fflush(stdout);
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
printf(" start long mcexec...\n");
|
||||
fflush(stdout);
|
||||
sprintf(cmd, "%s/bin/mcexec sleep 5", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
return 0;
|
||||
}
|
||||
// usleep(100*1000);
|
||||
sleep(1);
|
||||
goto destroy;
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown during mcexec\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
OKNG(ret_ihklib != 0, "destroy during mcexec returned NOT 0\n");
|
||||
|
||||
// wait for child process
|
||||
waitpid(pid, &status, 0);
|
||||
usleep(100*1000);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
done_test:
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
162
test/mng_mod/issues/898_928/arm64/CT_007.c
Normal file
162
test/mng_mod/issues/898_928/arm64/CT_007.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* CT_007.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_007";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
goto shutdown;
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "mcexec\n");
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown before boot returned 0\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
//OKNG(ret_ihklib == 0, "destroy immediately after boot\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
165
test/mng_mod/issues/898_928/arm64/CT_008.c
Normal file
165
test/mng_mod/issues/898_928/arm64/CT_008.c
Normal file
@ -0,0 +1,165 @@
|
||||
/* CT_008.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_008";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "do mcexec\n");
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown after mcexec returned 0\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status returned SHUTDOWN or INACTIVE\n");
|
||||
|
||||
// shutdown again
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "shutdown after shutdown returned 0\n");
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
//OKNG(ret_ihklib == 0, "destroy immediately after boot\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
162
test/mng_mod/issues/898_928/arm64/CT_009.c
Normal file
162
test/mng_mod/issues/898_928/arm64/CT_009.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* CT_009.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ihklib.h>
|
||||
#include <sys/types.h>
|
||||
#include "mck_bps_conflict.h"
|
||||
#include "ct_okng.h"
|
||||
|
||||
static char prefix[256] = MCK_DIR;
|
||||
|
||||
static char test_name[64] = "CT_009";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int ret = 0, status, ret_ihklib;
|
||||
FILE *fp;
|
||||
char buf[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
|
||||
int cpus[4] = {6, 7, 8, 9};
|
||||
int num_cpus = 4;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
|
||||
printf("*** %s start *************************\n", test_name);
|
||||
fflush(stdout);
|
||||
/*--------------------------------------------
|
||||
* Preparing
|
||||
*--------------------------------------------*/
|
||||
sprintf(cmd, "%s/sbin/mcstop+release.sh", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/%s %s", prefix, PART_MOD_NAME, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
/*--------------------------------------------
|
||||
* Test
|
||||
*--------------------------------------------*/
|
||||
// create 0
|
||||
ret_ihklib = ihk_create_os(0);
|
||||
|
||||
// reserve cpus
|
||||
ret_ihklib = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// assign cpus
|
||||
ret_ihklib = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// reserve mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_reserve_mem (2)\n");
|
||||
|
||||
// assign mem 128m@0,128m@1
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 128*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 1;
|
||||
ret_ihklib = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img", prefix, TARGET);
|
||||
ret_ihklib = ihk_os_load(0, fn);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret_ihklib = ihk_os_kargs(0, kargs);
|
||||
//OKNG(ret_ihklib == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret_ihklib = ihk_os_boot(0);
|
||||
goto shutdown;
|
||||
OKNG(ret_ihklib == 0, "ihk_os_boot\n");
|
||||
|
||||
/* Make sure that all initialization related transactions between McKernel and IHK finish
|
||||
sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
sysfsm_req_setup
|
||||
sysfsm_setup */
|
||||
usleep(100*1000);
|
||||
|
||||
// create pseudofs
|
||||
ret_ihklib = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
//OKNG(ret_ihklib == 0 &&
|
||||
// strstr(buf, "/tmp/mcos/mcos0_sys") != NULL, "ihk_os_create_pseudofs()\n");
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", prefix);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "mcexec\n");
|
||||
|
||||
// shutdown
|
||||
shutdown:
|
||||
ret_ihklib = ihk_os_shutdown(0);
|
||||
OKNG(ret_ihklib == 0, "force shutdown immediately after boot returned 0\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret_ihklib = ihk_os_get_status(0);
|
||||
//OKNG(ret_ihklib == IHK_STATUS_SHUTDOWN ||
|
||||
// ret_ihklib == IHK_STATUS_INACTIVE, "ihk_os_get_status (5) returned %d\n", ret_ihklib);
|
||||
|
||||
destroy:
|
||||
ret_ihklib = ihk_destroy_os(0, 0);
|
||||
//OKNG(ret_ihklib == 0, "destroy immediately after boot\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
// destroy pseudofs
|
||||
ret_ihklib = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/%s", prefix, PART_MOD_NAME);
|
||||
status = system(cmd);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", prefix);
|
||||
status = system(cmd);
|
||||
|
||||
printf("*** All tests finished\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
46
test/mng_mod/issues/898_928/arm64/Makefile
Normal file
46
test/mng_mod/issues/898_928/arm64/Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
# Makefile COPYRIGHT FUJITSU LIMITED 2018
|
||||
CC = gcc
|
||||
MCK_DIR=/opt/ppos
|
||||
TARGET=ihklib001_lin CT_001 CT_002 CT_003 CT_004 CT_005 CT_006 CT_007 CT_008 CT_009
|
||||
|
||||
CPPFLAGS = -I$(MCK_DIR)/include
|
||||
LDFLAGS = -L$(MCK_DIR)/lib -lihk -Wl,-rpath -Wl,$(MCK_DIR)/lib -lbfd
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
CT_001: CT_001.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_002: CT_002.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_003: CT_003.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_004: CT_004.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_005: CT_005.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_006: CT_006.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_007: CT_007.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_008: CT_008.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
CT_009: CT_009.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
ihklib001_lin: ihklib001_lin.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $^
|
||||
|
||||
test:: $(TARGET)
|
||||
./run.sh
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
|
||||
112
test/mng_mod/issues/898_928/arm64/README
Normal file
112
test/mng_mod/issues/898_928/arm64/README
Normal file
@ -0,0 +1,112 @@
|
||||
/* README COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
|
||||
McKernel のブート処理/プロセス実行時処理とシャットダウン処理との衝突回避機能
|
||||
テストセットREADME
|
||||
|
||||
(1) テストの実行方法
|
||||
以下の手順でテストを実行する
|
||||
1. $HOME/.mck_test_configを用意する
|
||||
当該ファイルは、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
2. mck_bps_conflict.h の定数MCK_DIRの内容を、McKernelがインストールされているディレクトリに変更する
|
||||
デフォルトは/opt/ppos
|
||||
3. make test を実行する
|
||||
4. patch/force_shutdown.patchを適用したMcKernelを用意し、インストールする
|
||||
5. ./run_CT009.shを実行する
|
||||
|
||||
(2) テスト項目詳細
|
||||
1.ihklibテストスイートを用いた確認
|
||||
・ISSUE01(ihklib001_lin -b)
|
||||
ihklibテストスイートのihklib001_lin.c を以下のように修正して1000回繰り返し実行し、
|
||||
すべての実行においてテストをパスすることを確認した。
|
||||
- McKernelのブート処理の直後にgoto文を追加し、シャットダウン処理の直前に移動する
|
||||
|
||||
・ISSUE02(ihklib001_lin -x)
|
||||
ihklibテストスイートのihklib001_lin.c を以下のように修正して1000回繰り返し実行し、
|
||||
すべての実行においてテストをパスすることを確認した。
|
||||
- McKernelプロセス(mcexec)の実行直後にgoto文を追加し、シャットダウン処理の直前に移動する
|
||||
|
||||
なお、arm64版での実施では、ihklib001_lin.cを修正し、ihk_os_create_pseudofs()の成否判定をSKIPしている
|
||||
これは、arm64版の制限事項によるものである
|
||||
|
||||
2.McKernelの起動/終了の基本動作確認
|
||||
以下の条件でMcKernelの起動/終了が正常に行われることを確認する
|
||||
なお、McKernelの起動、終了の操作はihklibを用いて実施する
|
||||
|
||||
CT001:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. 起動の直後にMcKernelを終了(ihk_os_shutdown)する
|
||||
⇒ ihk_os_shutdownが0を返す
|
||||
|
||||
CT002:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. 起動の直後に対象のIHK_OSインスタンスを破棄(ihk_os_destroy)する
|
||||
⇒ ihk_os_destroyが0を返す
|
||||
|
||||
CT003:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. McKernelプロセスを実行する
|
||||
3. McKernelプロセスの実行終了直後にMcKernelを終了(ihk_os_shutdown)する
|
||||
⇒ ihk_os_shutdownが0を返す
|
||||
|
||||
CT004:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. McKernelプロセスを実行する
|
||||
3. McKernelプロセスの実行終了直後に対象のIHK_OSインスタンスを破棄(ihk_os_destroy)する
|
||||
⇒ ihk_os_destroyが0を返す
|
||||
|
||||
CT005:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. McKernelプロセスを実行する
|
||||
3. McKernelプロセスの実行中にMcKernelを終了(ihk_os_shutdown)する
|
||||
⇒ ihk_os_shutdownが0を返す
|
||||
|
||||
CT006:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. McKernelプロセスを実行する
|
||||
3. McKernelプロセスの実行中に対象のIHK_OSインスタンスを破棄(ihk_os_destroy)する
|
||||
⇒ ihk_os_destroyが0以外を返す(ref_count != 0)
|
||||
|
||||
CT007:
|
||||
1. McKernelの起動処理の中の、カーネルイメージのロード(ihk_os_load)までを実施する
|
||||
2. McKernelを終了(ihk_os_shutdown)する
|
||||
⇒ ihk_os_shutdownが0を返す
|
||||
|
||||
CT008:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. McKernelプロセスを実行する
|
||||
3. McKernelプロセスの実行終了直後にMcKernelを終了(ihk_os_shutdown)する
|
||||
4. ihk_os_get_status がSHUTDOWNまたは、INACTIVEを返すことを確認する
|
||||
5. 終了したMcKernelに対して、再度終了(ihk_os_shutdown)する
|
||||
⇒ ihk_os_shutdownが0を返す
|
||||
|
||||
CT009のみ、McKernelにパッチを適用する必要がある
|
||||
前提条件として、force_shutdown.patch を適用してビルドしたMcKernelを用いる
|
||||
|
||||
CT009:
|
||||
1. McKernelを起動(ihk_os_boot)する
|
||||
2. 起動の直後にMcKernelを終了(ihk_os_shutdown)する
|
||||
⇒ ihk_os_shutdownが0を返す
|
||||
|
||||
(3) 実行結果ログ
|
||||
result.logファイル内に実行時のログを記載する。
|
||||
パッチを適用したMcKernelが必要になるCT009については、
|
||||
result_CT009.logファイル内に実行時のログを記載する。
|
||||
|
||||
実行に利用したIHK/McKernelは、IA版における下記の版数相当の
|
||||
arm64版移植IHK/McKernelである。
|
||||
|
||||
IHK
|
||||
commit d6fcbee8cb91f9ec4b49f97c918e696ac0335aaf
|
||||
Author: Shiratori, Takehiro <fj0300es@aa.jp.fujitsu.com>
|
||||
Date: Tue Oct 16 16:25:33 2018 +0900
|
||||
|
||||
McKernel
|
||||
commit 6f9fef2b13447c74c36d15cf5ebd186f8395ccca
|
||||
Author: Ken Sato <ken.sato.ty@hitachi-solutions.com>
|
||||
Date: Tue Sep 25 10:05:41 2018 +0900
|
||||
|
||||
(4) 備考
|
||||
特になし。
|
||||
|
||||
以上。
|
||||
30
test/mng_mod/issues/898_928/arm64/ct_okng.h
Normal file
30
test/mng_mod/issues/898_928/arm64/ct_okng.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* ct_okng.h COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#ifndef _CT_OKNG_H
|
||||
#define _CT_OKNG_H
|
||||
|
||||
#define OKNG(cond, ...) \
|
||||
do { \
|
||||
if(cond) { \
|
||||
printf("[OK] "); \
|
||||
printf(__VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
} \
|
||||
else { \
|
||||
char buf[65536]; \
|
||||
char cmd[256]; \
|
||||
FILE* fp = NULL; \
|
||||
size_t nread = 0; \
|
||||
\
|
||||
printf("[NG] "); \
|
||||
printf(__VA_ARGS__); \
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 kmsg", prefix); \
|
||||
fp = popen(cmd, "r"); \
|
||||
nread = fread(buf, 1, sizeof(buf), fp); \
|
||||
buf[nread] = 0; \
|
||||
printf("%s", buf); \
|
||||
fflush(stdout); \
|
||||
goto fn_fail; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#endif /* _CTOKNG_H */
|
||||
895
test/mng_mod/issues/898_928/arm64/ihklib001_lin.c
Normal file
895
test/mng_mod/issues/898_928/arm64/ihklib001_lin.c
Normal file
@ -0,0 +1,895 @@
|
||||
/* ihklib001_lin.c COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <getopt.h>
|
||||
#include <ihklib.h>
|
||||
#include <mckernel/ihklib_rusage.h>
|
||||
#include "util.h"
|
||||
#include "mck_bps_conflict.h"
|
||||
|
||||
#define DEBUG
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret, status;
|
||||
FILE *fp, *fp1, *fp2;
|
||||
char buf[65536], buf1[65536], buf2[65536];
|
||||
size_t nread;
|
||||
|
||||
char cmd[1024];
|
||||
char fn[256];
|
||||
char kargs[256];
|
||||
char logname[256], *envstr, *groups;
|
||||
|
||||
int cpus[4];
|
||||
int num_cpus;
|
||||
|
||||
struct ihk_mem_chunk mem_chunks[4];
|
||||
int num_mem_chunks;
|
||||
int indices[2];
|
||||
int num_os_instances;
|
||||
ssize_t kmsg_size;
|
||||
struct ihk_ikc_cpu_map ikc_map[2];
|
||||
int num_numa_nodes;
|
||||
unsigned long memfree[4];
|
||||
int num_pgsizes;
|
||||
long pgsizes[3];
|
||||
struct mckernel_rusage rusage;
|
||||
char *retstr;
|
||||
int boot_shutdown = 0;
|
||||
int mcexec_shutdown = 0;
|
||||
int ikc_map_by_func = 0;
|
||||
int opt;
|
||||
|
||||
while ((opt = getopt(argc, argv, "bxm")) != -1) {
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
boot_shutdown = 1;
|
||||
break;
|
||||
case 'x':
|
||||
mcexec_shutdown = 1;
|
||||
break;
|
||||
case 'm':
|
||||
ikc_map_by_func = 1;
|
||||
break;
|
||||
default: /* '?' */
|
||||
printf("unknown option %c\n", optopt);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fp = popen("logname", "r");
|
||||
nread = fread(logname, 1, sizeof(logname), fp);
|
||||
CHKANDJUMP(nread == 0, -1, "%s: ERROR: fread\n",
|
||||
__func__);
|
||||
retstr = strrchr(logname, '\n');
|
||||
if (retstr) {
|
||||
*retstr = 0;
|
||||
}
|
||||
printf("logname=%s\n", logname);
|
||||
|
||||
envstr = getenv("MYGROUPS");
|
||||
CHKANDJUMP(envstr == NULL, -1, "%s: ERROR: MYGROUPS not defined\n",
|
||||
__func__);
|
||||
groups = strdup(envstr);
|
||||
retstr = strrchr(groups, '\n');
|
||||
if (retstr) {
|
||||
*retstr = 0;
|
||||
}
|
||||
printf("groups=%s\n", groups);
|
||||
|
||||
if (geteuid() != 0) {
|
||||
printf("Execute as a root\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
// ihk_os_destroy_pseudofs
|
||||
ret = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(ret == 0 &&
|
||||
strstr(buf, "/tmp/mcos/mcos0_sys") == NULL,
|
||||
"ihk_os_destroy_pseudofs (1)\n");
|
||||
#endif
|
||||
|
||||
/* Test error handling */
|
||||
|
||||
// reserve cpu
|
||||
cpus[0] = 3;
|
||||
cpus[2] = 1;
|
||||
num_cpus = 2;
|
||||
ret = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret != 0, "ihk_reserve_cpu (1)\n");
|
||||
|
||||
// get # of reserved cpus
|
||||
num_cpus = ihk_get_num_reserved_cpus(0);
|
||||
//printf("num_cpus=%d\n", num_cpus);
|
||||
OKNG(num_cpus < 0, "ihk_get_num_reserved_cpu (1)\n");
|
||||
|
||||
// get reserved cpus
|
||||
ret = ihk_query_cpu(0, cpus, 1);
|
||||
OKNG(ret != 0, "ihk_query_cpu (1)\n");
|
||||
|
||||
// release cpu
|
||||
cpus[0] = 1;
|
||||
num_cpus = 1;
|
||||
ret = ihk_release_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret != 0, "ihk_release_cpu (1)\n");
|
||||
|
||||
// reserve mem 128m@0,64m@0: expected to fail
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 64*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 0;
|
||||
ret = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret != 0, "ihk_reserve_mem w/o /dev/mcd0\n");
|
||||
|
||||
// get # of reserved mem chunks: exptected to fail
|
||||
num_mem_chunks = ihk_get_num_reserved_mem_chunks(0);
|
||||
OKNG(num_mem_chunks < 0,
|
||||
"ihk_get_num_reserved_mem_chunks w/o /dev/mcd0\n");
|
||||
|
||||
// get reserved mem chunks: exptected to fail
|
||||
ret = ihk_query_mem(0, mem_chunks, 1);
|
||||
OKNG(ret != 0, "ihk_query_mem (1)\n");
|
||||
|
||||
// release mem 128m@0: expected to fail
|
||||
num_mem_chunks = 1;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
ret = ihk_release_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret != 0, "ihk_release_mem w/o /dev/mcd0\n");
|
||||
|
||||
// create
|
||||
ret = ihk_create_os(0);
|
||||
OKNG(ret != 0, "ihk_create_os (1)\n");
|
||||
|
||||
// get # of OS instances
|
||||
num_os_instances = ihk_get_num_os_instances(0);
|
||||
//printf("num_os_instances=%d\n", num_os_instances);
|
||||
OKNG(num_os_instances < 0, "ihk_get_num_os_instances (1)\n");
|
||||
|
||||
// get OS instances
|
||||
ret = ihk_get_os_instances(0, indices, 1);
|
||||
OKNG(ret != 0, "ihk_get_os_instances (1)\n");
|
||||
|
||||
// get os_instances
|
||||
sprintf(cmd, "%s/sbin/ihkconfig 0 get os_instances", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "0") == NULL,
|
||||
"ihkconfig 0 get os_instances (1) returned:\n%s\n", buf);
|
||||
|
||||
// destroy
|
||||
ret = ihk_destroy_os(0, 0);
|
||||
OKNG(ret != 0, "ihk_destroy_os (1)\n");
|
||||
|
||||
/* Expected to succeed */
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/ihk.ko", MCK_DIR);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
sprintf(cmd,
|
||||
"insmod %s/kmod/ihk-smp-%s.ko %s",
|
||||
MCK_DIR, ARCH, PART_MOD_PARAM);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
sprintf(cmd, "chown %s:%s /dev/mcd*\n", logname, groups);
|
||||
printf("%s\n", cmd);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
sprintf(cmd, "insmod %s/kmod/mcctrl.ko", MCK_DIR);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
// reserve cpu
|
||||
cpus[0] = 3;
|
||||
cpus[1] = 1;
|
||||
num_cpus = 2;
|
||||
ret = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// get # of reserved cpus
|
||||
num_cpus = ihk_get_num_reserved_cpus(0);
|
||||
OKNG(num_cpus == 2, "ihk_get_num_reserved_cpu (2)\n");
|
||||
|
||||
// get reserved cpus. Note that cpu# is sorted in ihk.
|
||||
ret = ihk_query_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0 &&
|
||||
cpus[0] == 1 &&
|
||||
cpus[1] == 3, "ihk_query_cpu (2)\n");
|
||||
|
||||
// release cpu
|
||||
cpus[0] = 1;
|
||||
num_cpus = 1;
|
||||
ret = ihk_release_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_release_cpu (2)\n");
|
||||
|
||||
// get # of reserved cpus
|
||||
num_cpus = ihk_get_num_reserved_cpus(0);
|
||||
OKNG(num_cpus == 1, "ihk_get_num_reserved_cpu (3)\n");
|
||||
|
||||
// get reserved cpus
|
||||
ret = ihk_query_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0 &&
|
||||
cpus[0] == 3, "ihk_query_cpu (3)\n");
|
||||
|
||||
// reserve cpu
|
||||
cpus[0] = 1;
|
||||
num_cpus = 1;
|
||||
ret = ihk_reserve_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_reserve_cpu\n");
|
||||
|
||||
// get # of reserved cpus
|
||||
num_cpus = ihk_get_num_reserved_cpus(0);
|
||||
OKNG(num_cpus == 2, "ihk_get_num_reserved_cpu (3)\n");
|
||||
|
||||
// get reserved cpus. Note that cpu# is sorted in ihk.
|
||||
ret = ihk_query_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0 &&
|
||||
cpus[0] == 1 &&
|
||||
cpus[1] == 3, "ihk_query_cpu (4)\n");
|
||||
|
||||
// reserve mem 128m@0,64m@0
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 64*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 0;
|
||||
ret = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0, "ihk_reserve_mem\n");
|
||||
|
||||
// get # of reserved mem chunks
|
||||
num_mem_chunks = ihk_get_num_reserved_mem_chunks(0);
|
||||
OKNG(num_mem_chunks == 2, "ihk_get_num_reserved_mem_chunks\n");
|
||||
|
||||
// get reserved mem chunks
|
||||
ret = ihk_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0 &&
|
||||
((mem_chunks[0].size == 128*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 64*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0) ||
|
||||
(mem_chunks[0].size == 64*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 128*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0)), "ihk_query_mem (2)\n");
|
||||
|
||||
// release mem 128m@0
|
||||
num_mem_chunks = 1;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
ret = ihk_release_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0, "ihk_release_mem w/o /dev/mcd0\n");
|
||||
|
||||
// get # of reserved mem chunks
|
||||
num_mem_chunks = ihk_get_num_reserved_mem_chunks(0);
|
||||
OKNG(num_mem_chunks == 1, "ihk_get_num_reserved_mem_chunks\n");
|
||||
|
||||
// get reserved mem chunks
|
||||
ret = ihk_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0 &&
|
||||
mem_chunks[0].size == 64*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0, "ihk_query_mem (3)\n");
|
||||
|
||||
// reserve mem 128m@0
|
||||
num_mem_chunks = 1;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
ret = ihk_reserve_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0, "ihk_reserve_mem\n");
|
||||
|
||||
// get # of reserved mem chunks
|
||||
num_mem_chunks = ihk_get_num_reserved_mem_chunks(0);
|
||||
OKNG(num_mem_chunks == 2, "ihk_get_num_reserved_mem_chunks\n");
|
||||
|
||||
// get reserved mem chunks
|
||||
ret = ihk_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0 &&
|
||||
((mem_chunks[0].size == 128*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 64*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0) ||
|
||||
(mem_chunks[0].size == 64*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 128*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0)), "ihk_query_mem (3)\n");
|
||||
|
||||
/* Test error handling */
|
||||
|
||||
// assign cpu 3,1
|
||||
num_cpus = 2;
|
||||
cpus[0] = 3;
|
||||
cpus[1] = 1;
|
||||
ret = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret != 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// get # of assigned cpus
|
||||
num_cpus = ihk_os_get_num_assigned_cpus(0);
|
||||
OKNG(num_cpus < 0, "ihk_os_get_num_assigned_cpus\n");
|
||||
|
||||
// get assigned cpus
|
||||
ret = ihk_os_query_cpu(0, cpus, 2);
|
||||
OKNG(ret != 0, "ihk_os_query_cpu (4)\n");
|
||||
|
||||
// release cpu
|
||||
num_cpus = 1;
|
||||
cpus[0] = 1;
|
||||
ret = ihk_os_release_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret != 0, "ihk_os_release_cpu (1)\n");
|
||||
|
||||
// assign mem 128m@0,64m@0
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 64*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 0;
|
||||
ret = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret != 0, "ihk_os_assign_mem (1)\n");
|
||||
|
||||
// get # of assigned mem chunks
|
||||
num_mem_chunks = ihk_os_get_num_assigned_mem_chunks(0);
|
||||
OKNG(num_mem_chunks < 0, "ihk_os_get_num_assigned_mem_chunks\n");
|
||||
|
||||
// get assigned mem chunks
|
||||
ret = ihk_os_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret != 0, "ihk_os_query_mem (1)\n");
|
||||
|
||||
// release mem chunks
|
||||
num_mem_chunks = 1;
|
||||
mem_chunks[0].size = 64*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
ret = ihk_os_release_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret != 0, "ihk_os_release_mem\n");
|
||||
|
||||
if (ikc_map_by_func) {
|
||||
// set ikc_map
|
||||
ikc_map[0].src_cpu = 3;
|
||||
ikc_map[0].dst_cpu = 0;
|
||||
ikc_map[0].src_cpu = 1;
|
||||
ikc_map[0].dst_cpu = 2;
|
||||
ret = ihk_os_set_ikc_map(0, ikc_map, 2);
|
||||
OKNG(ret != 0, "ihk_os_set_ikc_map\n");
|
||||
|
||||
// get ikc_map
|
||||
ret = ihk_os_get_ikc_map(0, ikc_map, 2);
|
||||
OKNG(ret != 0, "ihk_os_get_ikc_map (1)\n");
|
||||
} else {
|
||||
// set ikc_map
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 set ikc_map 3:0+1:2 2>&1",
|
||||
MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "rror") != NULL,
|
||||
"ihkconfig 0 set ikc_map (1)\n");
|
||||
|
||||
// get ikc_map
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 get ikc_map 2>&1",
|
||||
MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "3:0+1:2") == NULL,
|
||||
"ihkconfig 0 get ikc_map (1) returned:\n%s\n", buf);
|
||||
}
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img",
|
||||
MCK_DIR, TARGET);
|
||||
printf("%s\n", fn);
|
||||
ret = ihk_os_load(0, fn);
|
||||
OKNG(ret != 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret = ihk_os_kargs(0, kargs);
|
||||
OKNG(ret != 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret = ihk_os_boot(0);
|
||||
OKNG(ret != 0, "ihk_os_boot\n");
|
||||
|
||||
// get status
|
||||
ret = ihk_os_get_status(0);
|
||||
OKNG(ret < 0, "ihk_os_get_status (1)\n");
|
||||
|
||||
// get status
|
||||
sprintf(cmd, "%s//sbin/ihkosctl 0 get status 2>&1", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "rror") != NULL,
|
||||
"ihkconfig 0 get status (1) returned:\n%s\n", buf);
|
||||
|
||||
// create pseudofs
|
||||
ret = ihk_os_create_pseudofs(0, 0, 0);
|
||||
OKNG(ret != 0, "ihk_os_create_pseudofs\n");
|
||||
|
||||
// kmsg size
|
||||
kmsg_size = ihk_os_get_kmsg_size(0);
|
||||
OKNG(kmsg_size < 0, "ihk_os_get_kmsg_size\n");
|
||||
|
||||
// get kmsg
|
||||
ret = ihk_os_kmsg(0, buf, 256);
|
||||
OKNG(ret != 0, "ihk_os_kmsg returns %d\n", ret);
|
||||
|
||||
// clear kmsg
|
||||
ret = ihk_os_clear_kmsg(0);
|
||||
OKNG(ret != 0, "ihk_os_clear_kmsg\n");
|
||||
|
||||
// get # of NUMA nodes
|
||||
num_numa_nodes = ihk_os_get_num_numa_nodes(0);
|
||||
OKNG(num_numa_nodes < 0, "ihk_os_get_num_numa_nodes\n");
|
||||
|
||||
// query_free_mem
|
||||
ret = ihk_os_query_free_mem(0, memfree, num_numa_nodes);
|
||||
OKNG(ret != 0, "ihk_os_query_free_mem\n");
|
||||
|
||||
// get # of page sizes
|
||||
num_pgsizes = ihk_os_get_num_pagesizes(0);
|
||||
OKNG(num_pgsizes < 0, "ihk_os_get_num_pagesizes\n");
|
||||
|
||||
// get page sizes
|
||||
ret = ihk_os_get_pagesizes(0, pgsizes, num_pgsizes);
|
||||
OKNG(ret != 0, "ihk_os_get_pagesizes\n");
|
||||
|
||||
// get rusage
|
||||
ret = ihk_os_getrusage(0, &rusage, sizeof(rusage));
|
||||
OKNG(ret != 0, "ihk_os_getrusage\n");
|
||||
|
||||
// shutdown
|
||||
ret = ihk_os_shutdown(0);
|
||||
OKNG(ret != 0, "ihk_os_shutdown (1)\n");
|
||||
|
||||
// destroy os
|
||||
ret = ihk_destroy_os(0, 0);
|
||||
OKNG(ret != 0, "ihk_destroy_os (2)\n");
|
||||
|
||||
// destroy pseudofs. Note that it doesn't check the existence
|
||||
// of the OS.
|
||||
ret = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
OKNG(ret == 0, "ihk_os_destroy_pseudofs (2)\n");
|
||||
|
||||
/* Expected to succeed */
|
||||
|
||||
// create 0
|
||||
ret = ihk_create_os(0);
|
||||
OKNG(ret == 0, "ihk_create_os (2)\n");
|
||||
#if 0
|
||||
// create 1
|
||||
ret = ihk_create_os(0);
|
||||
OKNG(ret == 1, "ihk_create_os (3)\n");
|
||||
|
||||
// get # of OS instances
|
||||
num_os_instances = ihk_get_num_os_instances(0);
|
||||
OKNG(num_os_instances == 2, "ihk_get_num_os_instances (2)\n");
|
||||
|
||||
// get OS instances. Note that the index of the youngest OS
|
||||
// instance resides in [0].
|
||||
ret = ihk_get_os_instances(0, indices, num_os_instances);
|
||||
OKNG(ret == 0 &&
|
||||
indices[0] == 1 &&
|
||||
indices[1] == 0, "ihk_get_os_instances (2)\n");
|
||||
|
||||
// get os_instances
|
||||
sprintf(cmd, "%s//sbin/ihkconfig 0 get os_instances", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "0") != NULL && strstr(buf, "1") != NULL,
|
||||
"ihkconfig 0 get os_instances (2) returned:\n%s\n", buf);
|
||||
|
||||
// destroy one of them
|
||||
ret = ihk_destroy_os(0, 1);
|
||||
OKNG(ret == 0, "ihk_destroy_os (3)\n");
|
||||
|
||||
#else
|
||||
// get # of OS instances
|
||||
num_os_instances = ihk_get_num_os_instances(0);
|
||||
OKNG(num_os_instances == 1, "ihk_get_num_os_instances (2)\n");
|
||||
|
||||
// get OS instances. Note that the index of the youngest OS
|
||||
// instance resides in [0].
|
||||
ret = ihk_get_os_instances(0, indices, num_os_instances);
|
||||
OKNG(ret == 0 &&
|
||||
indices[0] == 0, "ihk_get_os_instances (2)\n");
|
||||
|
||||
// get os_instances
|
||||
sprintf(cmd, "%s//sbin/ihkconfig 0 get os_instances", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "0") != NULL,
|
||||
"ihkconfig 0 get os_instances (3) returned:\n%s\n", buf);
|
||||
#endif
|
||||
|
||||
// get status
|
||||
ret = ihk_os_get_status(0);
|
||||
OKNG(ret == IHK_STATUS_INACTIVE, "ihk_os_get_status (2)\n");
|
||||
|
||||
// get status
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 get status 2>&1", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "INACTIVE") != NULL,
|
||||
"ihkconfig 0 get status (2) returned:\n%s\n", buf);
|
||||
|
||||
sprintf(cmd, "chown %s:%s /dev/mcos*\n", logname, groups);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
// assign cpu 3,1
|
||||
num_cpus = 2;
|
||||
cpus[0] = 3;
|
||||
cpus[1] = 1;
|
||||
ret = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
// get # of assigned cpus
|
||||
num_cpus = ihk_os_get_num_assigned_cpus(0);
|
||||
OKNG(num_cpus == 2, "ihk_os_get_num_assigned_cpus\n");
|
||||
|
||||
// get assigned cpus
|
||||
ret = ihk_os_query_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0 &&
|
||||
cpus[0] == 3 &&
|
||||
cpus[1] == 1, "ihk_os_query_cpu (5)\n");
|
||||
|
||||
// release cpu
|
||||
num_cpus = 1;
|
||||
cpus[0] = 3;
|
||||
ret = ihk_os_release_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_os_release_cpu (2)\n");
|
||||
|
||||
// get # of assigned cpus
|
||||
num_cpus = ihk_os_get_num_assigned_cpus(0);
|
||||
OKNG(num_cpus == 1, "ihk_os_get_num_assigned_cpus\n");
|
||||
|
||||
// get assigned cpus
|
||||
ret = ihk_os_query_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0 &&
|
||||
cpus[0] == 1, "ihk_os_query_cpu (6)\n");
|
||||
|
||||
// release cpu
|
||||
num_cpus = 1;
|
||||
cpus[0] = 1;
|
||||
ret = ihk_os_release_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_os_release_cpu (3)\n");
|
||||
|
||||
// assign cpu 3,1
|
||||
num_cpus = 2;
|
||||
cpus[0] = 3;
|
||||
cpus[1] = 1;
|
||||
ret = ihk_os_assign_cpu(0, cpus, num_cpus);
|
||||
OKNG(ret == 0, "ihk_os_assign_cpu\n");
|
||||
|
||||
if (ikc_map_by_func) {
|
||||
// set ikc_map
|
||||
ikc_map[0].src_cpu = 3;
|
||||
ikc_map[0].dst_cpu = 0;
|
||||
ikc_map[1].src_cpu = 1;
|
||||
ikc_map[1].dst_cpu = 2;
|
||||
ret = ihk_os_set_ikc_map(0, ikc_map, num_cpus);
|
||||
OKNG(ret == 0, "ihk_os_set_ikc_map\n");
|
||||
|
||||
// get ikc_map
|
||||
ret = ihk_os_get_ikc_map(0, ikc_map, num_cpus);
|
||||
OKNG(ret == 0 &&
|
||||
ikc_map[0].src_cpu == 3 &&
|
||||
ikc_map[0].dst_cpu == 0 &&
|
||||
ikc_map[1].src_cpu == 1 &&
|
||||
ikc_map[1].dst_cpu == 2, "ihk_os_get_ikc_map (2)\n");
|
||||
} else {
|
||||
// set ikc_map
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 set ikc_map 3:0+1:2 2>&1",
|
||||
MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "rror") == NULL,
|
||||
"ihkconfig 0 set ikc_map (2)\n");
|
||||
|
||||
// get ikc_map
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 get ikc_map 2>&1",
|
||||
MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "3:0+1:2") != NULL,
|
||||
"ihkconfig 0 get ikc_map (2) returned:\n%s\n", buf);
|
||||
}
|
||||
|
||||
// assign mem 128m@0,64m@0
|
||||
num_mem_chunks = 2;
|
||||
mem_chunks[0].size = 128*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
mem_chunks[1].size = 64*1024*1024ULL;
|
||||
mem_chunks[1].numa_node_number = 0;
|
||||
ret = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0, "ihk_os_assign_mem (2)\n");
|
||||
|
||||
// get # of assigned mem chunks
|
||||
num_mem_chunks = ihk_os_get_num_assigned_mem_chunks(0);
|
||||
OKNG(num_mem_chunks == 2, "ihk_os_get_num_assigned_mem_chunks\n");
|
||||
|
||||
// get assigned mem chunks
|
||||
ret = ihk_os_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0 &&
|
||||
((mem_chunks[0].size == 128*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 64*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0) ||
|
||||
(mem_chunks[0].size == 64*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 128*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0)), "ihk_os_query_mem (2)\n");
|
||||
|
||||
// release mem chunks
|
||||
num_mem_chunks = 1;
|
||||
mem_chunks[0].size = 64*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
ret = ihk_os_release_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0, "ihk_os_release_mem\n");
|
||||
|
||||
// get # of assigned mem chunks
|
||||
num_mem_chunks = ihk_os_get_num_assigned_mem_chunks(0);
|
||||
OKNG(num_mem_chunks == 1, "ihk_os_get_num_assigned_mem_chunks\n");
|
||||
|
||||
// get assigned mem chunks
|
||||
ret = ihk_os_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0 &&
|
||||
mem_chunks[0].size == 128*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0, "ihk_os_query_mem (3)\n");
|
||||
|
||||
// assign mem 64m@0
|
||||
num_mem_chunks = 1;
|
||||
mem_chunks[0].size = 64*1024*1024ULL;
|
||||
mem_chunks[0].numa_node_number = 0;
|
||||
ret = ihk_os_assign_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0, "ihk_os_assign_mem (3)\n");
|
||||
|
||||
// get # of assigned mem chunks
|
||||
num_mem_chunks = ihk_os_get_num_assigned_mem_chunks(0);
|
||||
OKNG(num_mem_chunks == 2, "ihk_os_get_num_assigned_mem_chunks\n");
|
||||
|
||||
// get assigned mem chunks
|
||||
ret = ihk_os_query_mem(0, mem_chunks, num_mem_chunks);
|
||||
OKNG(ret == 0 &&
|
||||
((mem_chunks[0].size == 128*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 64*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0) ||
|
||||
(mem_chunks[0].size == 64*1024*1024ULL &&
|
||||
mem_chunks[0].numa_node_number == 0 &&
|
||||
mem_chunks[1].size == 128*1024*1024ULL &&
|
||||
mem_chunks[1].numa_node_number == 0)),
|
||||
"ihk_os_query_mem (4)\n");
|
||||
|
||||
// load
|
||||
sprintf(fn, "%s/%s/kernel/mckernel.img",
|
||||
MCK_DIR, TARGET);
|
||||
printf("%s\n", fn);
|
||||
ret = ihk_os_load(0, fn);
|
||||
OKNG(ret == 0, "ihk_os_load\n");
|
||||
|
||||
// kargs
|
||||
sprintf(kargs, "hidos ksyslogd=0");
|
||||
ret = ihk_os_kargs(0, kargs);
|
||||
OKNG(ret == 0, "ihk_os_kargs\n");
|
||||
|
||||
// boot
|
||||
ret = ihk_os_boot(0);
|
||||
OKNG(ret == 0, "ihk_os_boot\n");
|
||||
if (boot_shutdown) { /* #898 */
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
// get status
|
||||
ret = ihk_os_get_status(0);
|
||||
OKNG(ret == IHK_STATUS_BOOTING ||
|
||||
ret == IHK_STATUS_RUNNING, "ihk_os_get_status (3)\n");
|
||||
|
||||
// get status
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 get status 2>&1", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "BOOTING") != NULL ||
|
||||
strstr(buf, "RUNNING") != NULL,
|
||||
"ihkconfig 0 get status (3) returned:\n%s\n", buf);
|
||||
|
||||
/* Make sure that all initialization related transactions
|
||||
* between McKernel and IHK finish
|
||||
* sysfs_init(void) (in mckernel/kernel/sysfs.c)
|
||||
* packet.msg = SCD_MSG_SYSFS_REQ_SETUP;
|
||||
* sysfsm_work_main() in (mckernel/executer/kernel/mcctrl/sysfs.c)
|
||||
* sysfsm_req_setup
|
||||
* sysfsm_setup
|
||||
*/
|
||||
usleep(100*1000);
|
||||
|
||||
// get status
|
||||
ret = ihk_os_get_status(0);
|
||||
OKNG(ret == IHK_STATUS_RUNNING, "ihk_os_get_status (4)\n");
|
||||
|
||||
// get status
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 get status 2>&1", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "RUNNING") != NULL,
|
||||
"ihkconfig 0 get status (4) returned:\n%s\n", buf);
|
||||
|
||||
#if 0
|
||||
// create pseudofs
|
||||
ret = ihk_os_create_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(ret == 0 &&
|
||||
strstr(buf, "/tmp/mcos/mcos0_sys") != NULL,
|
||||
"ihk_os_create_pseudofs()\n");
|
||||
#endif
|
||||
|
||||
// get kmsg size
|
||||
kmsg_size = ihk_os_get_kmsg_size(0);
|
||||
OKNG(kmsg_size > 0, "ihk_os_get_kmsg_size\n");
|
||||
|
||||
// get kmsg
|
||||
ret = ihk_os_kmsg(0, buf, kmsg_size);
|
||||
OKNG(ret > 0 &&
|
||||
strstr(buf, "IHK/McKernel started.") != NULL, "ihk_os_kmsg\n");
|
||||
|
||||
// clear kmsg
|
||||
ret = ihk_os_clear_kmsg(0);
|
||||
OKNG(ret == 0, "ihk_os_clear_kmsg\n");
|
||||
|
||||
#if 0
|
||||
// get kmsg
|
||||
ret = ihk_os_kmsg(0, buf, kmsg_size);
|
||||
printf("%s,%d", strstr(buf, "IHK/McKernel started."), ret);
|
||||
OKNG(ret == 0 &&
|
||||
strstr(buf, "IHK/McKernel started.") == NULL,
|
||||
"ihk_os_kmsg returns %d\n", ret);
|
||||
#endif
|
||||
|
||||
// mcexec
|
||||
sprintf(cmd, "%s/bin/mcexec ls -l | grep Makefile", MCK_DIR);
|
||||
if (mcexec_shutdown) { /* #928 */
|
||||
status = system(cmd);
|
||||
goto shutdown;
|
||||
}
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "Makefile") != NULL, "mcexec\n");
|
||||
|
||||
// /proc
|
||||
sprintf(cmd, "%s/bin/mcexec cat /proc/stat", MCK_DIR);
|
||||
fp1 = popen(cmd, "r");
|
||||
nread = fread(buf1, 1, sizeof(buf1), fp1);
|
||||
buf1[nread] = 0;
|
||||
fp2 = popen("cat /proc/stat", "r");
|
||||
nread = fread(buf2, 1, sizeof(buf2), fp2);
|
||||
buf2[nread] = 0;
|
||||
OKNG(strcmp(buf1, buf2) != 0, "mcexec cat /proc/stat\n");
|
||||
|
||||
// get # of NUMA nodes
|
||||
num_numa_nodes = ihk_os_get_num_numa_nodes(0);
|
||||
OKNG(num_numa_nodes > 0, "ihk_os_get_num_numa_nodes\n");
|
||||
|
||||
// query_free_mem
|
||||
ret = ihk_os_query_free_mem(0, memfree, num_numa_nodes);
|
||||
OKNG(ret == 0 &&
|
||||
memfree[0] > 0, "ihk_os_query_free_mem\n");
|
||||
|
||||
// get # of page sizes
|
||||
num_pgsizes = ihk_os_get_num_pagesizes(0);
|
||||
OKNG(num_pgsizes == 3, "ihk_os_get_num_pagesizes\n");
|
||||
|
||||
// get page sizes
|
||||
ret = ihk_os_get_pagesizes(0, pgsizes, num_pgsizes);
|
||||
OKNG(ret == 0 &&
|
||||
pgsizes[0] == (1ULL<<12) &&
|
||||
pgsizes[1] == (1ULL<<21) &&
|
||||
pgsizes[2] == (1ULL<<30), "ihk_os_get_pagesizes\n");
|
||||
#if 1
|
||||
// shutdown
|
||||
// usleep(250*1000); // Wait for nothing is in-flight
|
||||
shutdown:
|
||||
ret = ihk_os_shutdown(0);
|
||||
OKNG(ret == 0, "ihk_os_shutdown (2)\n");
|
||||
|
||||
// get status. Note that the smp_ihk_os_shutdown() transitions
|
||||
// smp-x86 status to BUILTIN_OS_STATUS_SHUTDOWN
|
||||
// and smp_ihk_os_query_status() transitions os status to
|
||||
// IHK_OS_STATUS_NOT_BOOTED.
|
||||
ret = ihk_os_get_status(0);
|
||||
OKNG(ret == IHK_STATUS_SHUTDOWN ||
|
||||
ret == IHK_STATUS_INACTIVE,
|
||||
"ihk_os_get_status (5) returned %d\n", ret);
|
||||
|
||||
// get status
|
||||
sprintf(cmd, "%s/sbin/ihkosctl 0 get status 2>&1", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "SHUTDOWN") != NULL ||
|
||||
strstr(buf, "INACTIVE") != NULL,
|
||||
"ihkconfig 0 get status (5) returned:\n%s\n", buf);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
// destroy os
|
||||
usleep(250*1000); // Wait for nothing is in-flight
|
||||
ret = ihk_destroy_os(0, 0);
|
||||
OKNG(ret == 0, "ihk_destroy_os (4)\n");
|
||||
#else
|
||||
// destroy os
|
||||
usleep(250*1000); // Wait for nothing is in-flight
|
||||
sprintf(cmd, "%s/sbin/ihkconfig 0 destroy 0 2>&1", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "rror") == NULL,
|
||||
"ihkconfig 0 destroy 0 returned:\n%s\n", buf);
|
||||
#endif
|
||||
|
||||
// get # of OS instances
|
||||
num_os_instances = ihk_get_num_os_instances(0);
|
||||
OKNG(num_os_instances == 0, "ihk_get_num_os_instances (3)\n");
|
||||
|
||||
// get OS instances
|
||||
ret = ihk_get_os_instances(0, indices, num_os_instances);
|
||||
OKNG(ret == 0, "ihk_get_os_instances (3)\n");
|
||||
|
||||
// get os_instances
|
||||
sprintf(cmd, "%s/sbin/ihkconfig 0 get os_instances", MCK_DIR);
|
||||
fp = popen(cmd, "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(strstr(buf, "0") == NULL,
|
||||
"ihkconfig 0 get os_instances (4) returned:\n%s\n", buf);
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/mcctrl.ko", MCK_DIR);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
// destroy pseudofs
|
||||
ret = ihk_os_destroy_pseudofs(0, 0, 0);
|
||||
fp = popen("cat /proc/mounts | grep /tmp/mcos/mcos0_sys", "r");
|
||||
nread = fread(buf, 1, sizeof(buf), fp);
|
||||
buf[nread] = 0;
|
||||
OKNG(ret == 0 &&
|
||||
strstr(buf, "/tmp/mcos/mcos0_sys") == NULL,
|
||||
"ihk_os_destroy_pseudofs (3)\n");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk-smp-%s.ko",
|
||||
MCK_DIR, ARCH);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
sprintf(cmd, "rmmod %s/kmod/ihk.ko", MCK_DIR);
|
||||
status = system(cmd);
|
||||
CHKANDJUMP(WEXITSTATUS(status) != 0, -1, "system");
|
||||
|
||||
printf("[INFO] All tests finished\n");
|
||||
ret = 0;
|
||||
|
||||
fn_exit:
|
||||
return ret;
|
||||
fn_fail:
|
||||
goto fn_exit;
|
||||
}
|
||||
23
test/mng_mod/issues/898_928/arm64/mck_bps_conflict.h
Normal file
23
test/mng_mod/issues/898_928/arm64/mck_bps_conflict.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* mck_bps_conflict.h COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#ifndef _MCK_BPS_CONFLICT_H
|
||||
#define _MCK_BPS_CONFLICT_H
|
||||
|
||||
#define MCK_DIR "/opt/ppos"
|
||||
|
||||
#ifdef __aarch64__
|
||||
#define ARCH "arm64"
|
||||
#define TARGET "smp-arm64"
|
||||
#define PART_MOD_NAME "ihk-smp-arm64.ko"
|
||||
#define PART_MOD_PARAM "ihk_nr_irq=4 ihk_start_irq=60"
|
||||
#define TARGET "smp-arm64"
|
||||
#elif defined(__x86_64__)
|
||||
#define ARCH "x86_64"
|
||||
#define TARGET "smp-x86"
|
||||
#define PART_MOD_NAME "ihk-smp-x86_64.ko"
|
||||
#define PART_MOD_PARAM "ihk_start_irq=240 ihk_ikc_irq_core=0"
|
||||
#define TARGET "smp-x86"
|
||||
#else
|
||||
#error "Non-compliant architecture."
|
||||
#endif
|
||||
|
||||
#endif /* _MCK_BPS_CONFLICT_H */
|
||||
21
test/mng_mod/issues/898_928/arm64/patch/force_shutdown.patch
Normal file
21
test/mng_mod/issues/898_928/arm64/patch/force_shutdown.patch
Normal file
@ -0,0 +1,21 @@
|
||||
# force_shutdown.patch COPYRIGHT FUJITSU LIMITED 2018
|
||||
diff --git a/executer/kernel/mcctrl/driver.c b/executer/kernel/mcctrl/driver.c
|
||||
index 1588f63..9d91154 100644
|
||||
--- a/executer/kernel/mcctrl/driver.c
|
||||
+++ b/executer/kernel/mcctrl/driver.c
|
||||
@@ -171,12 +171,12 @@ int mcctrl_os_shutdown_notifier(int os_index)
|
||||
{
|
||||
if (os[os_index]) {
|
||||
/* Wait for os running */
|
||||
- if (ihk_os_wait_for_status(os[os_index], IHK_OS_STATUS_RUNNING, 0, 200) != 0) {
|
||||
- printk("IHK: OS does not become RUNNING in shutdown. Force shutdown.\n");
|
||||
+// if (ihk_os_wait_for_status(os[os_index], IHK_OS_STATUS_RUNNING, 0, 200) != 0) {
|
||||
+// printk("IHK: OS does not become RUNNING in shutdown. Force shutdown.\n");
|
||||
/* send nmi to force shutdown */
|
||||
ihk_os_send_nmi(os[os_index], 3);
|
||||
mdelay(200);
|
||||
- }
|
||||
+// }
|
||||
|
||||
pager_cleanup();
|
||||
sysfsm_cleanup(os[os_index]);
|
||||
62
test/mng_mod/issues/898_928/arm64/result.log
Normal file
62
test/mng_mod/issues/898_928/arm64/result.log
Normal file
@ -0,0 +1,62 @@
|
||||
gcc -o ihklib001_lin -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd ihklib001_lin.c
|
||||
gcc -o CT_001 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_001.c
|
||||
gcc -o CT_002 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_002.c
|
||||
gcc -o CT_003 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_003.c
|
||||
gcc -o CT_004 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_004.c
|
||||
gcc -o CT_005 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_005.c
|
||||
gcc -o CT_006 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_006.c
|
||||
gcc -o CT_007 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_007.c
|
||||
gcc -o CT_008 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_008.c
|
||||
gcc -o CT_009 -I/opt/ppos/include -L/opt/ppos/lib -lihk -Wl,-rpath -Wl,/opt/ppos/lib -lbfd CT_009.c
|
||||
./run.sh
|
||||
mcstop+release.sh ... done
|
||||
ISSUE01 n=1000/1000 ok.
|
||||
ISSUE01: OK
|
||||
ISSUE02 n=1000/1000 ok.
|
||||
ISSUE02: OK
|
||||
*** CT_001 start *************************
|
||||
[OK] shutdown immediately after boot returned 0
|
||||
*** All tests finished
|
||||
|
||||
*** CT_002 start *************************
|
||||
[OK] destroy immediately after boot returned NOT 0
|
||||
*** All tests finished
|
||||
|
||||
*** CT_003 start *************************
|
||||
[OK] ihk_os_boot
|
||||
[OK] done mcexec
|
||||
[OK] shutdown after mcexec returned 0
|
||||
*** All tests finished
|
||||
|
||||
*** CT_004 start *************************
|
||||
[OK] ihk_os_boot
|
||||
[OK] do mcexec
|
||||
[OK] destroy after mcexec returned 0
|
||||
*** All tests finished
|
||||
|
||||
*** CT_005 start *************************
|
||||
[OK] ihk_os_boot
|
||||
start long mcexec...
|
||||
[OK] shutdown during mcexec returned 0
|
||||
(But, mcexec process remain due to #846)
|
||||
*** All tests finished
|
||||
|
||||
*** CT_006 start *************************
|
||||
[OK] ihk_os_boot
|
||||
start long mcexec...
|
||||
ioctl failed
|
||||
[OK] destroy during mcexec returned NOT 0
|
||||
*** All tests finished
|
||||
|
||||
*** CT_007 start *************************
|
||||
[OK] shutdown before boot returned 0
|
||||
*** All tests finished
|
||||
|
||||
*** CT_008 start *************************
|
||||
[OK] ihk_os_boot
|
||||
[OK] do mcexec
|
||||
[OK] shutdown after mcexec returned 0
|
||||
[OK] ihk_os_get_status returned SHUTDOWN or INACTIVE
|
||||
[OK] shutdown after shutdown returned 0
|
||||
*** All tests finished
|
||||
|
||||
5
test/mng_mod/issues/898_928/arm64/result_CT009.log
Normal file
5
test/mng_mod/issues/898_928/arm64/result_CT009.log
Normal file
@ -0,0 +1,5 @@
|
||||
mcstop+release.sh ... done
|
||||
*** CT_009 start *************************
|
||||
[OK] force shutdown immediately after boot returned 0
|
||||
*** All tests finished
|
||||
|
||||
84
test/mng_mod/issues/898_928/arm64/run.sh
Executable file
84
test/mng_mod/issues/898_928/arm64/run.sh
Executable file
@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
## run.sh COPYRIGHT FUJITSU LIMITED 2018 ##
|
||||
|
||||
USELTP=0
|
||||
USEOSTEST=0
|
||||
MCREBOOT=0
|
||||
|
||||
. ../../../../common.sh
|
||||
|
||||
max_count=1000
|
||||
groups=`groups | cut -d' ' -f 1`
|
||||
|
||||
## ISSUE01
|
||||
result=0
|
||||
for count in `seq -f %04g 1 ${max_count}`
|
||||
do
|
||||
output=`MYGROUPS=${groups} ./ihklib001_lin -b 2>&1`
|
||||
echo "${output}" | grep -q "\[INFO\] All tests finished"
|
||||
if [ $? == 1 ]; then
|
||||
echo ""
|
||||
echo "${output}"
|
||||
echo "ISSUE01 not All tests finished."
|
||||
result=-1
|
||||
break
|
||||
fi
|
||||
|
||||
echo "${output}" | grep -q "\[ NG \]"
|
||||
if [ $? == 0 ]; then
|
||||
echo ""
|
||||
echo "${output}"
|
||||
echo "ISSUE01 NG detected."
|
||||
result=-1
|
||||
break
|
||||
fi
|
||||
|
||||
echo -en "ISSUE01 n=${count}/${max_count} ok.\r"
|
||||
done
|
||||
echo ""
|
||||
if [ ${result} == 0 ]; then
|
||||
echo "ISSUE01: OK"
|
||||
else
|
||||
echo "ISSUE01: NG"
|
||||
fi
|
||||
|
||||
## ISSUE02
|
||||
result=0
|
||||
for count in `seq -f %04g 1 ${max_count}`
|
||||
do
|
||||
output=`MYGROUPS=${groups} ./ihklib001_lin -x 2>&1`
|
||||
echo "${output}" | grep -q "\[INFO\] All tests finished"
|
||||
if [ $? == 1 ]; then
|
||||
echo ""
|
||||
echo "${output}"
|
||||
echo "ISSUE02 not All tests finished."
|
||||
result=-1
|
||||
break
|
||||
fi
|
||||
|
||||
echo "${output}" | grep -q "\[ NG \]"
|
||||
if [ $? == 0 ]; then
|
||||
echo ""
|
||||
echo "${output}"
|
||||
echo "ISSUE02 NG detected."
|
||||
result=-1
|
||||
break
|
||||
fi
|
||||
|
||||
echo -en "ISSUE02 n=${count}/${max_count} ok.\r"
|
||||
done
|
||||
echo ""
|
||||
if [ ${result} == 0 ]; then
|
||||
echo "ISSUE02: OK"
|
||||
else
|
||||
echo "ISSUE02: NG"
|
||||
fi
|
||||
|
||||
sudo ./CT_001
|
||||
sudo ./CT_002
|
||||
sudo ./CT_003
|
||||
sudo ./CT_004
|
||||
sudo ./CT_005
|
||||
sudo ./CT_006
|
||||
sudo ./CT_007
|
||||
sudo ./CT_008
|
||||
10
test/mng_mod/issues/898_928/arm64/run_CT009.sh
Executable file
10
test/mng_mod/issues/898_928/arm64/run_CT009.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
## run_CT009.sh COPYRIGHT FUJITSU LIMITED 2018 ##
|
||||
|
||||
USELTP=0
|
||||
USEOSTEST=0
|
||||
MCREBOOT=0
|
||||
|
||||
. ../../../../common.sh
|
||||
|
||||
sudo ./CT_009
|
||||
57
test/mng_mod/issues/898_928/arm64/util.h
Normal file
57
test/mng_mod/issues/898_928/arm64/util.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* util.h COPYRIGHT FUJITSU LIMITED 2018 */
|
||||
#ifndef __UTIL_H_INCLUDED__
|
||||
#define __UTIL_H_INCLUDED__
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define dprintf(...) do { \
|
||||
char msg[1024]; \
|
||||
sprintf(msg, __VA_ARGS__); \
|
||||
fprintf(stderr, "%s: %s", __func__, msg); \
|
||||
} while (0)
|
||||
#else
|
||||
#define dprintf(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define eprintf(...) do { \
|
||||
char msg[1024]; \
|
||||
sprintf(msg, __VA_ARGS__); \
|
||||
fprintf(stderr, "%s: ERROR: %s", __func__, msg); \
|
||||
} while (0)
|
||||
|
||||
#define CHKANDJUMP(cond, err, ...) do { \
|
||||
if (cond) { \
|
||||
eprintf(__VA_ARGS__); \
|
||||
ret = err; \
|
||||
goto fn_fail; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define _OKNG(verb, jump, cond, fmt, args...) do { \
|
||||
if (cond) { \
|
||||
if (verb) \
|
||||
printf("[ OK ] " fmt, ##args); \
|
||||
} else { \
|
||||
printf("[ NG ] " fmt, ##args); \
|
||||
if (jump) \
|
||||
goto fn_fail; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define OKNG(args...) _OKNG(1, 1, ##args)
|
||||
#define NG(args...) _OKNG(0, 1, ##args)
|
||||
#define OKNGNOJUMP(args...) _OKNG(1, 0, ##args)
|
||||
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
|
||||
extern char *mck_dir;
|
||||
extern char *arch;
|
||||
extern char *target;
|
||||
|
||||
int get_config(void);
|
||||
void destroy_config(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user