testsuite/smokey: net: Load rtnet module if missing
PATCH 1/1 testsuite/smokey: net: Load rtnet module if missing
From: Jan Kiszka <[email protected]>
This allows to run RTnet tests if the core is built as module but not yet loaded at the start of the test.
For that, silence error reports of 'modprobe rtnet'.
---
This should do the trick as well, just a bit simpler.
testsuite/smokey/net_common/setup.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
testsuite/smokey/net_common/setup.c +15 -7
@@ -138,7 +138,7 @@ static int do_down(const char *intf)return 0 ; } -static int smokey_net_modprobe (int modid) +static int smokey_net_modprobe (int modid,bool silent) {struct module *m = modules + modid;char buffer[128 ];
@@ -168,7 +168,8 @@ static int smokey_net_modprobe(int modid)smokey_trace ("%s module not there: modprobing" , m->name); err =smokey_check_errno ( -snprintf (buffer,sizeof (buffer),"modprobe %s" , m->name)); +snprintf (buffer,sizeof (buffer),"modprobe %s %s" , m->name, + silent ?"2>/dev/null" :"" ));if (err <0 )return err;
@@ -177,7 +178,8 @@ static int smokey_net_modprobe(int modid)return err;if (!WIFEXITED (err) ||WEXITSTATUS (err) !=0 ) { -smokey_warning ("%s: abnormal exit" , buffer); +if (!silent) +smokey_warning ("%s: abnormal exit" , buffer);return -EINVAL ; }
@@ -224,7 +226,7 @@ static int smokey_net_setup_rtcfg_client(const char *intf, int net_config)if ((net_config & _CC_COBALT_NET_CFG) ==0 )return -ENOSYS ; - err =smokey_net_modprobe (MODID_CFG ); + err =smokey_net_modprobe (MODID_CFG , false);if (err <0 )return err;
@@ -408,6 +410,12 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,struct sockaddr_in *in_peer = vpeer;struct sockaddr *peer = vpeer; +/* +* Main module needs to be loaded in order to use +* _CC_COBALT_GET_NET_CONFIG. +*/ +smokey_net_modprobe (MODID_RTNET , true); + err =cobalt_corectl (_CC_COBALT_GET_NET_CONFIG, &net_config,sizeof (net_config));if (err == -EINVAL )
@@ -423,15 +431,15 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,return -ENOSYS ; modules[MODID_DRIVER ].name = driver; - err =smokey_net_modprobe (MODID_DRIVER ); + err =smokey_net_modprobe (MODID_DRIVER , false);if (err <0 )return err; - err =smokey_net_modprobe (MODID_IPV4 ); + err =smokey_net_modprobe (MODID_IPV4 , false);if (err <0 )return err; - err =smokey_net_modprobe (option_to_modid (tested_config)); + err =smokey_net_modprobe (option_to_modid (tested_config), false);if (err <0 )return err;
Signature · 1 line
2.31.1
Quoted 67 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Friday, August 6, 2021 3:38 PM
To: Xenomai <[email protected]>
Cc: Chen, Hongzhan <[email protected]>
Subject: [PATCH] testsuite/smokey: net: Load rtnet module if missingFrom: Jan Kiszka <[email protected]>
This allows to run RTnet tests if the core is built as module but not yet loaded at the start of the test.
For that, silence error reports of 'modprobe rtnet'.
Signed-off-by Jan Kiszka <[email protected]>---
This should do the trick as well, just a bit simpler.
testsuite/smokey/net_common/setup.c| 22 +++++++++++++++-------1 file changed, 15 insertions(+), 7 deletions(-)testsuite/smokey/net_common/setup.c +6
-4@@ -138,7 +138,7 @@ static int do_down(const char *intf)return 0 ; } -static int smokey_net_modprobe (int modid) +static int smokey_net_modprobe (int modid,bool silent) {struct module *m = modules + modid;char buffer[128 ];@@ -168,7 +168,8 @@ static int smokey_net_modprobe(int modid)smokey_trace ("%s module not there: modprobing" , m->name); err =smokey_check_errno ( -snprintf (buffer,sizeof (buffer),"modprobe %s" , m->name)); +snprintf (buffer,sizeof (buffer),"modprobe %s %s" , m->name, + silent ?"2>/dev/null" :"" ));if (err <0 )return err;@@ -177,7 +178,8 @@ static int smokey_net_modprobe(int modid)return err;if (!WIFEXITED (err) ||WEXITSTATUS (err) !=0 ) { -smokey_warning ("%s: abnormal exit" , buffer); +if (!silent) +smokey_warning ("%s: abnormal exit" , buffer);return -EINVAL ; }@@ -224,7 +226,7 @@ static int smokey_net_setup_rtcfg_client(const char *intf, int net_config)if ((net_config & _CC_COBALT_NET_CFG) ==0 )return -ENOSYS ; - err =smokey_net_modprobe (MODID_CFG ); + err =smokey_net_modprobe (MODID_CFG , false);if (err <0 )return err;
testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417
Quoted 8 lines
testsuite/smokey/net_common/setup.c +5
-0@@ -408,6 +410,12 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,struct sockaddr_in *in_peer = vpeer;struct sockaddr *peer = vpeer; +/* +* Main module needs to be loaded in order to use +* _CC_COBALT_GET_NET_CONFIG. +*/ +smokey_net_modprobe (MODID_RTNET , true);
no need to check return value?
Regards
Hongzhan Chen
Quoted 25 lines
testsuite/smokey/net_common/setup.c +4
-3+ err =cobalt_corectl (_CC_COBALT_GET_NET_CONFIG, &net_config,sizeof (net_config));if (err == -EINVAL )@@ -423,15 +431,15 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,return -ENOSYS ; modules[MODID_DRIVER ].name = driver; - err =smokey_net_modprobe (MODID_DRIVER ); + err =smokey_net_modprobe (MODID_DRIVER , false);if (err <0 )return err; - err =smokey_net_modprobe (MODID_IPV4 ); + err =smokey_net_modprobe (MODID_IPV4 , false);if (err <0 )return err; - err =smokey_net_modprobe (option_to_modid (tested_config)); + err =smokey_net_modprobe (option_to_modid (tested_config), false);if (err <0 )return err;Signature · 1 line
2.31.1
Quoted 70 lines · Hongzhan
Quoted 70 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Friday, August 6, 2021 3:38 PM
To: Xenomai <[email protected]>
Cc: Chen, Hongzhan <[email protected]>
Subject: [PATCH] testsuite/smokey: net: Load rtnet module if missingFrom: Jan Kiszka <[email protected]>
This allows to run RTnet tests if the core is built as module but not yet loaded at the start of the test.
For that, silence error reports of 'modprobe rtnet'.
Signed-off-by Jan Kiszka <[email protected]>---
This should do the trick as well, just a bit simpler.
testsuite/smokey/net_common/setup.c| 22 +++++++++++++++-------1 file changed, 15 insertions(+), 7 deletions(-)testsuite/smokey/net_common/setup.c +6
-4@@ -138,7 +138,7 @@ static int do_down(const char *intf)return 0 ; } -static int smokey_net_modprobe (int modid) +static int smokey_net_modprobe (int modid,bool silent) {struct module *m = modules + modid;char buffer[128 ];@@ -168,7 +168,8 @@ static int smokey_net_modprobe(int modid)smokey_trace ("%s module not there: modprobing" , m->name); err =smokey_check_errno ( -snprintf (buffer,sizeof (buffer),"modprobe %s" , m->name)); +snprintf (buffer,sizeof (buffer),"modprobe %s %s" , m->name, + silent ?"2>/dev/null" :"" ));if (err <0 )return err;@@ -177,7 +178,8 @@ static int smokey_net_modprobe(int modid)return err;if (!WIFEXITED (err) ||WEXITSTATUS (err) !=0 ) { -smokey_warning ("%s: abnormal exit" , buffer); +if (!silent) +smokey_warning ("%s: abnormal exit" , buffer);return -EINVAL ; }@@ -224,7 +226,7 @@ static int smokey_net_setup_rtcfg_client(const char *intf, int net_config)if ((net_config & _CC_COBALT_NET_CFG) ==0 )return -ENOSYS ; - err =smokey_net_modprobe (MODID_CFG ); + err =smokey_net_modprobe (MODID_CFG , false);if (err <0 )return err;@@ -408,6 +410,12 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,struct sockaddr_in *in_peer = vpeer;struct sockaddr *peer = vpeer;
Quoted 8 lines
testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417
Quoted 5 lines
testsuite/smokey/net_common/setup.c +5
-0+/* +* Main module needs to be loaded in order to use +* _CC_COBALT_GET_NET_CONFIG. +*/ +smokey_net_modprobe (MODID_RTNET , true);no need to check return value?
Theoretically, we could miss the case that RTnet was configured but the module cannot be loaded. But I think this is negligible, and the alternative is rather complex.
We could rather add a "no kernel support" test to our lava jobs when all features are enabled. Will also ensure that we do not degrade on that again.
Jan
Quoted 28 lines
Regards
Hongzhan ChenQuoted 25 lines
testsuite/smokey/net_common/setup.c +4
-3+ err =cobalt_corectl (_CC_COBALT_GET_NET_CONFIG, &net_config,sizeof (net_config));if (err == -EINVAL )@@ -423,15 +431,15 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,return -ENOSYS ; modules[MODID_DRIVER ].name = driver; - err =smokey_net_modprobe (MODID_DRIVER ); + err =smokey_net_modprobe (MODID_DRIVER , false);if (err <0 )return err; - err =smokey_net_modprobe (MODID_IPV4 ); + err =smokey_net_modprobe (MODID_IPV4 , false);if (err <0 )return err; - err =smokey_net_modprobe (option_to_modid (tested_config)); + err =smokey_net_modprobe (option_to_modid (tested_config), false);if (err <0 )return err;Signature · 1 line
2.31.1
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
-----Original Message-----
Quoted 85 lines
From: Jan Kiszka <[email protected]>
Sent: Friday, August 6, 2021 4:12 PM
To: Chen, Hongzhan <[email protected]>; Xenomai <[email protected]>
Subject: Re: [PATCH] testsuite/smokey: net: Load rtnet module if missingQuoted 70 lines · Hongzhan
Quoted 70 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Friday, August 6, 2021 3:38 PM
To: Xenomai <[email protected]>
Cc: Chen, Hongzhan <[email protected]>
Subject: [PATCH] testsuite/smokey: net: Load rtnet module if missingFrom: Jan Kiszka <[email protected]>
This allows to run RTnet tests if the core is built as module but not yet loaded at the start of the test.
For that, silence error reports of 'modprobe rtnet'.
Signed-off-by Jan Kiszka <[email protected]>---
This should do the trick as well, just a bit simpler.
testsuite/smokey/net_common/setup.c| 22 +++++++++++++++-------1 file changed, 15 insertions(+), 7 deletions(-)testsuite/smokey/net_common/setup.c +6
-4@@ -138,7 +138,7 @@ static int do_down(const char *intf)return 0 ; } -static int smokey_net_modprobe (int modid) +static int smokey_net_modprobe (int modid,bool silent) {struct module *m = modules + modid;char buffer[128 ];@@ -168,7 +168,8 @@ static int smokey_net_modprobe(int modid)smokey_trace ("%s module not there: modprobing" , m->name); err =smokey_check_errno ( -snprintf (buffer,sizeof (buffer),"modprobe %s" , m->name)); +snprintf (buffer,sizeof (buffer),"modprobe %s %s" , m->name, + silent ?"2>/dev/null" :"" ));if (err <0 )return err;@@ -177,7 +178,8 @@ static int smokey_net_modprobe(int modid)return err;if (!WIFEXITED (err) ||WEXITSTATUS (err) !=0 ) { -smokey_warning ("%s: abnormal exit" , buffer); +if (!silent) +smokey_warning ("%s: abnormal exit" , buffer);return -EINVAL ; }@@ -224,7 +226,7 @@ static int smokey_net_setup_rtcfg_client(const char *intf, int net_config)if ((net_config & _CC_COBALT_NET_CFG) ==0 )return -ENOSYS ; - err =smokey_net_modprobe (MODID_CFG ); + err =smokey_net_modprobe (MODID_CFG , false);if (err <0 )return err;@@ -408,6 +410,12 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,struct sockaddr_in *in_peer = vpeer;struct sockaddr *peer = vpeer;Quoted 8 lines
testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417
Quoted 5 lines
testsuite/smokey/net_common/setup.c +5
-0+/* +* Main module needs to be loaded in order to use +* _CC_COBALT_GET_NET_CONFIG. +*/ +smokey_net_modprobe (MODID_RTNET , true);no need to check return value?
Quoted 1 line
Theoretically, we could miss the case that RTnet was configured but the
What about RTnet is not configured? New modinfo checking patch as we discussed to protect this?
Regards
Hongzhan Chen
Quoted 40 lines
module cannot be loaded. But I think this is negligible, and the alternative is rather complex.
We could rather add a "no kernel support" test to our lava jobs when all features are enabled. Will also ensure that we do not degrade on that again.
Jan
Quoted 27 lines
Regards
Hongzhan ChenQuoted 17 lines
testsuite/smokey/net_common/setup.c +3
-2+ err =cobalt_corectl (_CC_COBALT_GET_NET_CONFIG, &net_config,sizeof (net_config));if (err == -EINVAL )@@ -423,15 +431,15 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,return -ENOSYS ; modules[MODID_DRIVER ].name = driver; - err =smokey_net_modprobe (MODID_DRIVER ); + err =smokey_net_modprobe (MODID_DRIVER , false);if (err <0 )return err; - err =smokey_net_modprobe (MODID_IPV4 ); + err =smokey_net_modprobe (MODID_IPV4 , false);if (err <0 )return err;testsuite/smokey/net_common/setup.c +1
-1- err =smokey_net_modprobe (option_to_modid (tested_config)); + err =smokey_net_modprobe (option_to_modid (tested_config), false);if (err < 0) return err;Signature · 1 line
2.31.1Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 88 lines · Hongzhan
-----Original Message-----
Quoted 85 lines
From: Jan Kiszka <[email protected]>
Sent: Friday, August 6, 2021 4:12 PM
To: Chen, Hongzhan <[email protected]>; Xenomai <[email protected]>
Subject: Re: [PATCH] testsuite/smokey: net: Load rtnet module if missingQuoted 78 lines · Hongzhan
Quoted 67 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Friday, August 6, 2021 3:38 PM
To: Xenomai <[email protected]>
Cc: Chen, Hongzhan <[email protected]>
Subject: [PATCH] testsuite/smokey: net: Load rtnet module if missingFrom: Jan Kiszka <[email protected]>
This allows to run RTnet tests if the core is built as module but not yet loaded at the start of the test.
For that, silence error reports of 'modprobe rtnet'.
Signed-off-by Jan Kiszka <[email protected]>---
This should do the trick as well, just a bit simpler.
testsuite/smokey/net_common/setup.c| 22 +++++++++++++++-------1 file changed, 15 insertions(+), 7 deletions(-)testsuite/smokey/net_common/setup.c +6
-4@@ -138,7 +138,7 @@ static int do_down(const char *intf)return 0 ; } -static int smokey_net_modprobe (int modid) +static int smokey_net_modprobe (int modid,bool silent) {struct module *m = modules + modid;char buffer[128 ];@@ -168,7 +168,8 @@ static int smokey_net_modprobe(int modid)smokey_trace ("%s module not there: modprobing" , m->name); err =smokey_check_errno ( -snprintf (buffer,sizeof (buffer),"modprobe %s" , m->name)); +snprintf (buffer,sizeof (buffer),"modprobe %s %s" , m->name, + silent ?"2>/dev/null" :"" ));if (err <0 )return err;@@ -177,7 +178,8 @@ static int smokey_net_modprobe(int modid)return err;if (!WIFEXITED (err) ||WEXITSTATUS (err) !=0 ) { -smokey_warning ("%s: abnormal exit" , buffer); +if (!silent) +smokey_warning ("%s: abnormal exit" , buffer);return -EINVAL ; }@@ -224,7 +226,7 @@ static int smokey_net_setup_rtcfg_client(const char *intf, int net_config)if ((net_config & _CC_COBALT_NET_CFG) ==0 )return -ENOSYS ; - err =smokey_net_modprobe (MODID_CFG ); + err =smokey_net_modprobe (MODID_CFG , false);if (err <0 )return err;testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417
Quoted 8 lines
testsuite/smokey/net_common/setup.c +5
-0@@ -408,6 +410,12 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,struct sockaddr_in *in_peer = vpeer;struct sockaddr *peer = vpeer; +/* +* Main module needs to be loaded in order to use +* _CC_COBALT_GET_NET_CONFIG. +*/ +smokey_net_modprobe (MODID_RTNET , true);no need to check return value?
Quoted 3 lines
Quoted 1 line
Theoretically, we could miss the case that RTnet was configured but the
What about RTnet is not configured? New modinfo checking patch as we discussed to protect this?
If RTnet is not configured, the test will fail silently ("no kernel support"). If we don't want that case for our CI/CT setup, we need to check the output for such messages and fail the test run at lava level.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux