tests: Remove (mostly) useless architecture checks
PATCH 1/1 tests: Remove (mostly) useless architecture checks
These checks at the beginning of some of the tests are mostly useless:
We only run the tests on x86 anyway, and g_test_message() does not print anything unless you call g_test_init() first.
--- tests/fdc-test.c | 7 ------- tests/ide-test.c | 7 ------- tests/ipmi-bt-test.c | 7 ------- tests/ipmi-kcs-test.c | 7 ------- 4 files changed, 28 deletions(-)
tests/fdc-test.c +0 -7
@@ -548,16 +548,9 @@ static void fuzz_registers(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create a temporary raw image */ fd =mkstemp (test_image);g_assert (fd >=0 );
tests/ide-test.c +0 -7
@@ -1009,16 +1009,9 @@ static void test_cdrom_dma(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create temporary blkdebug instructions */ fd =mkstemp (debug_path);g_assert (fd >=0 );
tests/ipmi-bt-test.c +0 -7
@@ -400,15 +400,8 @@ static void open_socket(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -open_socket ();/* Run the tests */
tests/ipmi-kcs-test.c +0 -7
@@ -263,16 +263,9 @@ static void test_enable_irq(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();char *cmdline;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Run the tests */ g_test_init (&argc, &argv,NULL );
Signature · 1 line
1.8.3.1
Quoted 86 lines · Thomas Huth
These checks at the beginning of some of the tests are mostly useless:
We only run the tests on x86 anyway, andg_test_message()does not print anything unless you callg_test_init()first.Signed-off-by Thomas Huth <[email protected]>--- tests/fdc-test.c | 7 ------- tests/ide-test.c | 7 ------- tests/ipmi-bt-test.c | 7 ------- tests/ipmi-kcs-test.c | 7 ------- 4 files changed, 28 deletions(-)tests/fdc-test.c +0
-7@@ -548,16 +548,9 @@ static void fuzz_registers(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create a temporary raw image */ fd =mkstemp (test_image);g_assert (fd >=0 );tests/ide-test.c +0
-7@@ -1009,16 +1009,9 @@ static void test_cdrom_dma(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create temporary blkdebug instructions */ fd =mkstemp (debug_path);g_assert (fd >=0 );tests/ipmi-bt-test.c +0
-7@@ -400,15 +400,8 @@ static void open_socket(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -open_socket ();/* Run the tests */ tests/ipmi-kcs-test.c +0
-1@@ -263,16 +263,9 @@ static void test_enable_irq(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();char *cmdline;int ret;
tests/ipmi-kcs-test.c static void test_enable_irq(void) · line 271
Quoted 10 lines
tests/ipmi-kcs-test.c +0
-6-/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Run the tests */ g_test_init (&argc, &argv,NULL );
Hm, if you insist. I have no strong feelings... Do we plan to split tests out by architecture eventually? Clearly x86 only tests don't really need to each individually check the arch, but I'm not sure what the vision is.
Either way, since I have no horse in the race:
Corey Minyard
Acked-byQuoted 89 lines · John Snow
Quoted 86 lines · Thomas Huth
These checks at the beginning of some of the tests are mostly useless:
We only run the tests on x86 anyway, andg_test_message()does not print anything unless you callg_test_init()first.Signed-off-by Thomas Huth <[email protected]>--- tests/fdc-test.c | 7 ------- tests/ide-test.c | 7 ------- tests/ipmi-bt-test.c | 7 ------- tests/ipmi-kcs-test.c | 7 ------- 4 files changed, 28 deletions(-)tests/fdc-test.c +0
-7@@ -548,16 +548,9 @@ static void fuzz_registers(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create a temporary raw image */ fd =mkstemp (test_image);g_assert (fd >=0 );tests/ide-test.c +0
-7@@ -1009,16 +1009,9 @@ static void test_cdrom_dma(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create temporary blkdebug instructions */ fd =mkstemp (debug_path);g_assert (fd >=0 );tests/ipmi-bt-test.c +0
-7@@ -400,15 +400,8 @@ static void open_socket(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -open_socket ();/* Run the tests */ tests/ipmi-kcs-test.c +0
-1@@ -263,16 +263,9 @@ static void test_enable_irq(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();char *cmdline;int ret;
Quoted 15 lines
tests/ipmi-kcs-test.c static void test_enable_irq(void) · line 271
Quoted 10 lines
tests/ipmi-kcs-test.c +0
-6-/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Run the tests */ g_test_init (&argc, &argv,NULL );Hm, if you insist. I have no strong feelings... Do we plan to split tests out by architecture eventually? Clearly x86 only tests don't really need to each individually check the arch, but I'm not sure what the vision is.
Hmm, I don't have strong feelings, either, but I assume that you would want to leave the door open for testing on arches besides x86. The IPMI device is used by at least powerpc, and probably in some upcoming ARM64 systems.
But in that case you would want to remove these checks, anyway, and find some other way to know if you want to run the test. So...
Quoted 4 lines
Either way, since I have no horse in the race:
Acked-by John Snow <[email protected]>
Quoted 89 lines · John Snow
Quoted 86 lines · Thomas Huth
These checks at the beginning of some of the tests are mostly useless:
We only run the tests on x86 anyway, andg_test_message()does not print anything unless you callg_test_init()first.Signed-off-by Thomas Huth <[email protected]>--- tests/fdc-test.c | 7 ------- tests/ide-test.c | 7 ------- tests/ipmi-bt-test.c | 7 ------- tests/ipmi-kcs-test.c | 7 ------- 4 files changed, 28 deletions(-)tests/fdc-test.c +0
-7@@ -548,16 +548,9 @@ static void fuzz_registers(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create a temporary raw image */ fd =mkstemp (test_image);g_assert (fd >=0 );tests/ide-test.c +0
-7@@ -1009,16 +1009,9 @@ static void test_cdrom_dma(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create temporary blkdebug instructions */ fd =mkstemp (debug_path);g_assert (fd >=0 );tests/ipmi-bt-test.c +0
-7@@ -400,15 +400,8 @@ static void open_socket(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -open_socket ();/* Run the tests */ tests/ipmi-kcs-test.c +0
-1@@ -263,16 +263,9 @@ static void test_enable_irq(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();char *cmdline;int ret;
Quoted 15 lines
tests/ipmi-kcs-test.c static void test_enable_irq(void) · line 271
Quoted 10 lines
tests/ipmi-kcs-test.c +0
-6-/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Run the tests */ g_test_init (&argc, &argv,NULL );Hm, if you insist. I have no strong feelings... Do we plan to split tests out by architecture eventually? Clearly x86 only tests don't really need to each individually check the arch, but I'm not sure what the vision is.
We could also fix the g_test_message() output by moving it after the g_test_init() ... I don't mind too much which way we go, but at least the current state is bad.
Looking at other tests, we seem to be pretty inconsistent in checking the architecture at the beginning. For example q35-test.c, pvpanic-test.c and test-x86-cpuid.c do not check for x86, while rtas-test.c has a check for ppc64...
Quoted 3 lines
Either way, since I have no horse in the race:
Acked-by John Snow <[email protected]>
Thanks!
Thomas
Quoted 115 lines · Thomas Huth
Quoted 89 lines · John Snow
Quoted 86 lines · Thomas Huth
These checks at the beginning of some of the tests are mostly useless:
We only run the tests on x86 anyway, andg_test_message()does not print anything unless you callg_test_init()first.Signed-off-by Thomas Huth <[email protected]>--- tests/fdc-test.c | 7 ------- tests/ide-test.c | 7 ------- tests/ipmi-bt-test.c | 7 ------- tests/ipmi-kcs-test.c | 7 ------- 4 files changed, 28 deletions(-)tests/fdc-test.c +0
-7@@ -548,16 +548,9 @@ static void fuzz_registers(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create a temporary raw image */ fd =mkstemp (test_image);g_assert (fd >=0 );tests/ide-test.c +0
-7@@ -1009,16 +1009,9 @@ static void test_cdrom_dma(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create temporary blkdebug instructions */ fd =mkstemp (debug_path);g_assert (fd >=0 );tests/ipmi-bt-test.c +0
-7@@ -400,15 +400,8 @@ static void open_socket(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -open_socket ();/* Run the tests */ tests/ipmi-kcs-test.c +0
-1@@ -263,16 +263,9 @@ static void test_enable_irq(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();char *cmdline;int ret;Quoted 15 lines
tests/ipmi-kcs-test.c static void test_enable_irq(void) · line 271
Quoted 10 lines
tests/ipmi-kcs-test.c +0
-6-/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Run the tests */ g_test_init (&argc, &argv,NULL );Hm, if you insist. I have no strong feelings... Do we plan to split tests out by architecture eventually? Clearly x86 only tests don't really need to each individually check the arch, but I'm not sure what the vision is.
We could also fix the
g_test_message()output by moving it after theg_test_init()... I don't mind too much which way we go, but at least the current state is bad.Looking at other tests, we seem to be pretty inconsistent in checking the architecture at the beginning. For example
q35-test.c,pvpanic-test.candtest-x86-cpuid.cdo not check for x86, whilertas-test.chas a check for ppc64...
Quoted 8 lines
Quoted 3 lines
Either way, since I have no horse in the race:
Acked-by John Snow <[email protected]>Thanks!
Thomas
In that case, might as well be consistent first and we can refactor our test suite when we have a reason to want to do that.
Thanks for the explanation!
--js
Laurent Vivier
AppliedQuoted 86 lines · Thomas Huth
These checks at the beginning of some of the tests are mostly useless:
We only run the tests on x86 anyway, andg_test_message()does not print anything unless you callg_test_init()first.Signed-off-by Thomas Huth <[email protected]>--- tests/fdc-test.c | 7 ------- tests/ide-test.c | 7 ------- tests/ipmi-bt-test.c | 7 ------- tests/ipmi-kcs-test.c | 7 ------- 4 files changed, 28 deletions(-)tests/fdc-test.c +0
-7@@ -548,16 +548,9 @@ static void fuzz_registers(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create a temporary raw image */ fd =mkstemp (test_image);g_assert (fd >=0 );tests/ide-test.c +0
-7@@ -1009,16 +1009,9 @@ static void test_cdrom_dma(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int fd;int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Create temporary blkdebug instructions */ fd =mkstemp (debug_path);g_assert (fd >=0 );tests/ipmi-bt-test.c +0
-7@@ -400,15 +400,8 @@ static void open_socket(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();int ret; -/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -open_socket ();/* Run the tests */ tests/ipmi-kcs-test.c +0
-1@@ -263,16 +263,9 @@ static void test_enable_irq(void)int main (int argc,char **argv) { -const char *arch =qtest_get_arch ();char *cmdline;int ret;
tests/ipmi-kcs-test.c static void test_enable_irq(void) · line 271
Quoted 10 lines
tests/ipmi-kcs-test.c +0
-6-/* Check architecture */ -if (strcmp (arch,"i386" ) &&strcmp (arch,"x86_64" )) { -g_test_message ("Skipping test for non-x86\n" ); -return 0 ; - } -/* Run the tests */ g_test_init (&argc, &argv,NULL );
Applied to my trivial-patches branch.
Thanks,
Laurent