@ -23,18 +23,19 @@ static void test_mon_explicit(const void *data)
{
char * s ;
char * cli ;
QTestState * qts ;
cli = make_cli ( data , " -smp 8 "
" -numa node,nodeid=0,cpus=0-3 "
" -numa node,nodeid=1,cpus=4-7 " ) ;
qtest_star t ( cli ) ;
qts = qtest_ini t ( cli ) ;
s = hmp ( " info numa " ) ;
s = qtest_ hmp( qts , " info numa " ) ;
g_assert ( strstr ( s , " node 0 cpus: 0 1 2 3 " ) ) ;
g_assert ( strstr ( s , " node 1 cpus: 4 5 6 7 " ) ) ;
g_free ( s ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}
@ -42,16 +43,17 @@ static void test_mon_default(const void *data)
{
char * s ;
char * cli ;
QTestState * qts ;
cli = make_cli ( data , " -smp 8 -numa node -numa node " ) ;
qtest_star t ( cli ) ;
qts = qtest_ini t ( cli ) ;
s = hmp ( " info numa " ) ;
s = qtest_ hmp( qts , " info numa " ) ;
g_assert ( strstr ( s , " node 0 cpus: 0 2 4 6 " ) ) ;
g_assert ( strstr ( s , " node 1 cpus: 1 3 5 7 " ) ) ;
g_free ( s ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}
@ -59,24 +61,25 @@ static void test_mon_partial(const void *data)
{
char * s ;
char * cli ;
QTestState * qts ;
cli = make_cli ( data , " -smp 8 "
" -numa node,nodeid=0,cpus=0-1 "
" -numa node,nodeid=1,cpus=4-5 " ) ;
qtest_star t ( cli ) ;
qts = qtest_ini t ( cli ) ;
s = hmp ( " info numa " ) ;
s = qtest_ hmp( qts , " info numa " ) ;
g_assert ( strstr ( s , " node 0 cpus: 0 1 2 3 6 7 " ) ) ;
g_assert ( strstr ( s , " node 1 cpus: 4 5 " ) ) ;
g_free ( s ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}
static QList * get_cpus ( QDict * * resp )
static QList * get_cpus ( QTestState * qts , Q Dict * * resp )
{
* resp = qmp ( " { 'execute': 'query-cpus' } " ) ;
* resp = qtest_q mp ( qts , " { 'execute': 'query-cpus' } " ) ;
g_assert ( * resp ) ;
g_assert ( qdict_haskey ( * resp , " return " ) ) ;
return qdict_get_qlist ( * resp , " return " ) ;
@ -88,10 +91,11 @@ static void test_query_cpus(const void *data)
QDict * resp ;
QList * cpus ;
QObject * e ;
QTestState * qts ;
cli = make_cli ( data , " -smp 8 -numa node,cpus=0-3 -numa node,cpus=4-7 " ) ;
qtest_star t ( cli ) ;
cpus = get_cpus ( & resp ) ;
qts = qtest_ini t ( cli ) ;
cpus = get_cpus ( qts , & resp ) ;
g_assert ( cpus ) ;
while ( ( e = qlist_pop ( cpus ) ) ) {
@ -115,7 +119,7 @@ static void test_query_cpus(const void *data)
}
qobject_unref ( resp ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}
@ -125,6 +129,7 @@ static void pc_numa_cpu(const void *data)
QDict * resp ;
QList * cpus ;
QObject * e ;
QTestState * qts ;
cli = make_cli ( data , " -cpu pentium -smp 8,sockets=2,cores=2,threads=2 "
" -numa node,nodeid=0 -numa node,nodeid=1 "
@ -132,8 +137,8 @@ static void pc_numa_cpu(const void *data)
" -numa cpu,node-id=0,socket-id=1,core-id=0 "
" -numa cpu,node-id=0,socket-id=1,core-id=1,thread-id=0 "
" -numa cpu,node-id=1,socket-id=1,core-id=1,thread-id=1 " ) ;
qtest_star t ( cli ) ;
cpus = get_cpus ( & resp ) ;
qts = qtest_ini t ( cli ) ;
cpus = get_cpus ( qts , & resp ) ;
g_assert ( cpus ) ;
while ( ( e = qlist_pop ( cpus ) ) ) {
@ -168,7 +173,7 @@ static void pc_numa_cpu(const void *data)
}
qobject_unref ( resp ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}
@ -178,6 +183,7 @@ static void spapr_numa_cpu(const void *data)
QDict * resp ;
QList * cpus ;
QObject * e ;
QTestState * qts ;
cli = make_cli ( data , " -smp 4,cores=4 "
" -numa node,nodeid=0 -numa node,nodeid=1 "
@ -185,8 +191,8 @@ static void spapr_numa_cpu(const void *data)
" -numa cpu,node-id=0,core-id=1 "
" -numa cpu,node-id=0,core-id=2 "
" -numa cpu,node-id=1,core-id=3 " ) ;
qtest_star t ( cli ) ;
cpus = get_cpus ( & resp ) ;
qts = qtest_ini t ( cli ) ;
cpus = get_cpus ( qts , & resp ) ;
g_assert ( cpus ) ;
while ( ( e = qlist_pop ( cpus ) ) ) {
@ -213,7 +219,7 @@ static void spapr_numa_cpu(const void *data)
}
qobject_unref ( resp ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}
@ -223,13 +229,14 @@ static void aarch64_numa_cpu(const void *data)
QDict * resp ;
QList * cpus ;
QObject * e ;
QTestState * qts ;
cli = make_cli ( data , " -smp 2 "
" -numa node,nodeid=0 -numa node,nodeid=1 "
" -numa cpu,node-id=1,thread-id=0 "
" -numa cpu,node-id=0,thread-id=1 " ) ;
qtest_star t ( cli ) ;
cpus = get_cpus ( & resp ) ;
qts = qtest_ini t ( cli ) ;
cpus = get_cpus ( qts , & resp ) ;
g_assert ( cpus ) ;
while ( ( e = qlist_pop ( cpus ) ) ) {
@ -256,7 +263,7 @@ static void aarch64_numa_cpu(const void *data)
}
qobject_unref ( resp ) ;
qtest_end ( ) ;
qtest_quit ( qts ) ;
g_free ( cli ) ;
}