Skip to contentSkip to conversation

testsuite/smokey: net: load rtnet module if it has not been loaded

PATCH Superseded Hongzhan Chen 2 participants 7 messages Aug 4, 2021 – Aug 6, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 testsuite/smokey: net: load rtnet module if it has not been loaded

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +8 -0
index 1badabdfb..719d8175f 100644
@@ -408,6 +408,14 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,
 	struct sockaddr_in *in_peer = vpeer;
 	struct sockaddr *peer = vpeer;
 
+	err = access("/dev/rtnet", F_OK);
+	if (err) {
+		/* device does not exist and load rtnet*/
+		err = smokey_net_modprobe(MODID_RTNET);
+		if (err < 0)
+			return err;
+	}
+
 	err = cobalt_corectl(_CC_COBALT_GET_NET_CONFIG,
 			&net_config, sizeof(net_config));
 	if (err == -EINVAL)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 testsuite/smokey: net_client: skip late packet error in vm mode

In vm mode, skip late packet error in functional test to avoid test failure.

testsuite/smokey/net_common/client.c +3 -3
index d13d72918..752ea55ed 100644
@@ -204,7 +204,7 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 		} while (err != -ETIMEDOUT);
 	}
 
-	if (glost || glate)
+	if (glost || (!smokey_on_vm && glate))
 		fprintf(stderr, "RTnet %s test failed", client->name);
 	if (glost) {
 		if (glost == limit)
@@ -214,11 +214,11 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 			fprintf(stderr, ", %Lu packets lost (%g %%)",
 				glost, 100.0 * glost / limit);
 	}
-	if (glate)
+	if (!smokey_on_vm && glate)
 		fprintf(stderr, ", %Lu overruns", glate);
 	if (glost || glate)
 		fputc('\n', stderr);
-	err = glost || glate ? -EPROTO : 0;
+	err = glost || (!smokey_on_vm && glate) ? -EPROTO : 0;
 
   err:
 	sock = smokey_check_errno(__RT(close(sock)));
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 19 lines · Hongzhan Chen via Xenomai

In vm mode, skip late packet error in functional test to avoid test failure.

testsuite/smokey/net_common/client.c +1 -1
index d13d72918..752ea55ed 100644
@@ -204,7 +204,7 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 		} while (err != -ETIMEDOUT);
 	}
 
-	if (glost || glate)
+	if (glost || (!smokey_on_vm && glate))
 		fprintf(stderr, "RTnet %s test failed", client->name);
 	if (glost) {
 		if (glost == limit)

testsuite/smokey/net_common/client.c static int smokey_net_client_loop(struct smokey_net_client *client) · line 218

Quoted 6 lines
testsuite/smokey/net_common/client.c +1 -1
@@ -214,11 +214,11 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 			fprintf(stderr, ", %Lu packets lost (%g %%)",
 				glost, 100.0 * glost / limit);
 	}
-	if (glate)
+	if (!smokey_on_vm && glate)
 		fprintf(stderr, ", %Lu overruns", glate);

I think we can keep this report, just not mark the test failed in case of smokey_on_vm.

testsuite/smokey/net_common/client.c static int smokey_net_client_loop(struct smokey_net_client *client) · line 224

Quoted 8 lines
testsuite/smokey/net_common/client.c +1 -1
 	if (glost || glate)
 		fputc('\n', stderr);
-	err = glost || glate ? -EPROTO : 0;
+	err = glost || (!smokey_on_vm && glate) ? -EPROTO : 0;
 
   err:
 	sock = smokey_check_errno(__RT(close(sock)));

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#3 lore raw

RE: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 22 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, August 4, 2021 6:20 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 13 lines · Hongzhan Chen via Xenomai

In vm mode, skip late packet error in functional test to avoid test failure.

testsuite/smokey/net_common/client.c +0 -0
index d13d72918..752ea55ed 100644
@@ -204,7 +204,7 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 		} while (err != -ETIMEDOUT);
 	}
 
Quoted 15 lines

testsuite/smokey/net_common/client.c static int smokey_net_client_loop(struct smokey_net_client *client) · line 218

Quoted 12 lines
testsuite/smokey/net_common/client.c +2 -2
-	if (glost || glate)
+	if (glost || (!smokey_on_vm && glate))
 		fprintf(stderr, "RTnet %s test failed", client->name);
 	if (glost) {
 		if (glost == limit)
@@ -214,11 +214,11 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 			fprintf(stderr, ", %Lu packets lost (%g %%)",
 				glost, 100.0 * glost / limit);
 	}
-	if (glate)
+	if (!smokey_on_vm && glate)
 		fprintf(stderr, ", %Lu overruns", glate);

I think we can keep this report, just not mark the test failed in case of smokey_on_vm.

But this string printed out here looks like ugly in case of smokey_on_vm., do we need to change something ? How about :

if (!smokey_on_vm && glate)

          fprintf(stderr, "there is %Lu overruns", glate);
else if (glate)
         fprintf(stderr, ", %Lu overruns", glate);
Quoted 15 lines

testsuite/smokey/net_common/client.c static int smokey_net_client_loop(struct smokey_net_client *client) · line 224

Quoted 9 lines
testsuite/smokey/net_common/client.c +1 -1
 	if (glost || glate)
 		fputc('\n', stderr);
-	err = glost || glate ? -EPROTO : 0;
+	err = glost || (!smokey_on_vm && glate) ? -EPROTO : 0;
 
   err:
 	sock = smokey_check_errno(__RT(close(sock)));

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#4 lore raw

Re: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 38 lines · Hongzhan
Quoted 22 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, August 4, 2021 6:20 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 13 lines · Hongzhan Chen via Xenomai

In vm mode, skip late packet error in functional test to avoid test failure.

testsuite/smokey/net_common/client.c +0 -0
index d13d72918..752ea55ed 100644
@@ -204,7 +204,7 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 		} while (err != -ETIMEDOUT);
 	}
 
Quoted 15 lines

testsuite/smokey/net_common/client.c static int smokey_net_client_loop(struct smokey_net_client *client) · line 218

Quoted 12 lines
testsuite/smokey/net_common/client.c +2 -2
-	if (glost || glate)
+	if (glost || (!smokey_on_vm && glate))
 		fprintf(stderr, "RTnet %s test failed", client->name);
 	if (glost) {
 		if (glost == limit)
@@ -214,11 +214,11 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 			fprintf(stderr, ", %Lu packets lost (%g %%)",
 				glost, 100.0 * glost / limit);
 	}
-	if (glate)
+	if (!smokey_on_vm && glate)
 		fprintf(stderr, ", %Lu overruns", glate);

I think we can keep this report, just not mark the test failed in case of smokey_on_vm.

Quoted 8 lines

But this string printed out here looks like ugly in case of smokey_on_vm., do we need to change something ? How about :

if (!smokey_on_vm && glate)

          fprintf(stderr, "there is %Lu overruns", glate);
else if (glate)
         fprintf(stderr, ", %Lu overruns", glate);

Hmm, what is the difference?

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#5 lore raw

Re: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 42 lines · Jan Kiszka via Xenomai
Quoted 41 lines · Hongzhan
Quoted 22 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, August 4, 2021 6:20 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] testsuite/smokey: net_client: skip late packet error in vm mode

Quoted 13 lines · Hongzhan Chen via Xenomai

In vm mode, skip late packet error in functional test to avoid test failure.

testsuite/smokey/net_common/client.c +0 -0
index d13d72918..752ea55ed 100644
@@ -204,7 +204,7 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 		} while (err != -ETIMEDOUT);
 	}
 
Quoted 15 lines

testsuite/smokey/net_common/client.c static int smokey_net_client_loop(struct smokey_net_client *client) · line 218

Quoted 12 lines
testsuite/smokey/net_common/client.c +2 -2
-	if (glost || glate)
+	if (glost || (!smokey_on_vm && glate))
 		fprintf(stderr, "RTnet %s test failed", client->name);
 	if (glost) {
 		if (glost == limit)
@@ -214,11 +214,11 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 			fprintf(stderr, ", %Lu packets lost (%g %%)",
 				glost, 100.0 * glost / limit);
 	}
-	if (glate)
+	if (!smokey_on_vm && glate)
 		fprintf(stderr, ", %Lu overruns", glate);

I think we can keep this report, just not mark the test failed in case of smokey_on_vm.

But this string printed out here looks like ugly in case of smokey_on_vm., do we need to change something ? How about :

Quoted 8 lines
Quoted 5 lines

if (!smokey_on_vm && glate)

          fprintf(stderr, "there is %Lu overruns", glate);
else if (glate)
         fprintf(stderr, ", %Lu overruns", glate);

Hmm, what is the difference?

OK, sorry, now I see the relevance. Applied this one.

Thanks,
Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#6 lore raw
In reply to Hongzhan Chen

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 411

Quoted 13 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +1 -0
index 1badabdfb..719d8175f 100644
@@ -408,6 +408,14 @@ int smokey_net_setup(const char *driver, const char *intf, int tested_config,
 	struct sockaddr_in *in_peer = vpeer;
 	struct sockaddr *peer = vpeer;
 
+	err = access("/dev/rtnet", F_OK);

Not needed. smokey_net_modprobe() checks /proc/modules and loads only if the module is missing.

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 421

Quoted 11 lines
testsuite/smokey/net_common/setup.c +7 -0
+	if (err) {
+		/* device does not exist and load rtnet*/
+		err = smokey_net_modprobe(MODID_RTNET);
+		if (err < 0)
+			return err;
+	}
+
 	err = cobalt_corectl(_CC_COBALT_GET_NET_CONFIG,
 			&net_config, sizeof(net_config));
 	if (err == -EINVAL)

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux