Skip to contentSkip to conversation

bootconfig: Fix testcase to increase max node

PATCH Superseded Masami Hiramatsu (Google) 2 participants 3 messages Mar 13, 2023 – Mar 15, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 bootconfig: Fix testcase to increase max node

From: Masami Hiramatsu (Google) <[email protected]>

Since commit 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig from 1024 to 8192 for DCC support") increased the max number of bootconfig node to 8192, the bootconfig testcase of the max number of nodes fails. To fix this issue, we can not simply increase the number in the test script because the test bootconfig file becomes too big (>32KB). To fix that, we can use a combination of three alphabets (26^3 = 17576). But with that, we can not express the 8193 (just one exceed from the limitation) because it also exceeds the max size of bootconfig. So, the first 26 nodes will just use one alphabet.

With this fix, test-bootconfig.sh passes all tests.

Fixes 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig from 1024 to 8192 for DCC support")
---
 tools/bootconfig/test-bootconfig.sh |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
tools/bootconfig/test-bootconfig.sh +12 -5
index f68e2e9eef8b..b1b77d76110d 100755
@@ -14,10 +14,11 @@ ALIGN=4
 INITRD=`mktemp ${TESTDIR}/initrd-XXXX`
 TEMPCONF=`mktemp ${TESTDIR}/temp-XXXX.bconf`
 OUTFILE=`mktemp ${TESTDIR}/tempout-XXXX`
+AWKFILE=`mktemp ${TESTDIR}/temp-XXXX.awk`
 NG=0
 
 cleanup() {
-  rm -f $INITRD $TEMPCONF $OUTFILE
+  rm -f $INITRD $TEMPCONF $OUTFILE $AWKFILE
   exit $NG
 }
 
@@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
 
 echo "Max node number check"
 
-echo -n > $TEMPCONF
-for i in `seq 1 1024` ; do
-   echo "node$i" >> $TEMPCONF
-done
+cat > $AWKFILE << EOF
+BEGIN {
+  for (i = 0; i < 26; i += 1)
+      printf("%c\n", 65 + i % 26)
+  for (i = 26; i < 8192; i += 1)
+      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
+}
+EOF
+awk -f "$AWKFILE" > $TEMPCONF
+
 xpass $BOOTCONF -a $TEMPCONF $INITRD
 
 echo "badnode" >> $TEMPCONF
maintainer
#1 lore raw

tools/bootconfig/test-bootconfig.sh xfail grep -i "error" $OUTFILE · line 92

Quoted 7 lines · On Mon, 13 Mar 2023 22:56:09 +0900 "Masami Hiramatsu (Google)"…
tools/bootconfig/test-bootconfig.sh +0 -3
@@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
 
 echo "Max node number check"
 
-echo -n > $TEMPCONF
-for i in `seq 1 1024` ; do
-   echo "node$i" >> $TEMPCONF

Do you need this extra file?

tools/bootconfig/test-bootconfig.sh xfail grep -i "error" $OUTFILE · line 99

Quoted 10 lines
tools/bootconfig/test-bootconfig.sh +9 -1
-done
+cat > $AWKFILE << EOF
+BEGIN {
+  for (i = 0; i < 26; i += 1)
+      printf("%c\n", 65 + i % 26)
+  for (i = 26; i < 8192; i += 1)
+      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
+}
+EOF
+awk -f "$AWKFILE" > $TEMPCONF

Couldn't the above just be:

awk '

	BEGIN {
		for (i = 0; i < 26; i += 1)
			printf("%c\n", 65 + i % 26)
		for (i = 26; i < 8192; i += 1)
			printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
	}

' > $TEMPCONF

and not need the extra file?

-- Steve

Quoted 3 lines
tools/bootconfig/test-bootconfig.sh +0 -0
 xpass $BOOTCONF -a $TEMPCONF $INITRD
 
 echo "badnode" >> $TEMPCONF
author maintainer
#2 lore raw
Quoted 33 lines · On Tue, 14 Mar 2023 11:12:13 -0400 Steven Rostedt <[email protected]> wrote:

tools/bootconfig/test-bootconfig.sh xfail grep -i "error" $OUTFILE · line 92

Quoted 7 lines · On Mon, 13 Mar 2023 22:56:09 +0900 "Masami Hiramatsu (Google)"…
tools/bootconfig/test-bootconfig.sh +0 -3
@@ -87,10 +88,16 @@ xfail grep -i "error" $OUTFILE
 
 echo "Max node number check"
 
-echo -n > $TEMPCONF
-for i in `seq 1 1024` ; do
-   echo "node$i" >> $TEMPCONF

Do you need this extra file?

tools/bootconfig/test-bootconfig.sh xfail grep -i "error" $OUTFILE · line 99

Quoted 10 lines
tools/bootconfig/test-bootconfig.sh +9 -1
-done
+cat > $AWKFILE << EOF
+BEGIN {
+  for (i = 0; i < 26; i += 1)
+      printf("%c\n", 65 + i % 26)
+  for (i = 26; i < 8192; i += 1)
+      printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
+}
+EOF
+awk -f "$AWKFILE" > $TEMPCONF

Couldn't the above just be:

awk '

	BEGIN {
		for (i = 0; i < 26; i += 1)
			printf("%c\n", 65 + i % 26)
		for (i = 26; i < 8192; i += 1)
			printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26))
	}
Quoted 3 lines

' > $TEMPCONF

and not need the extra file?

Indeed. Let me update this.

Thank you!

Quoted 8 lines

-- Steve

Quoted 3 lines
tools/bootconfig/test-bootconfig.sh +0 -0
 xpass $BOOTCONF -a $TEMPCONF $INITRD
 
 echo "badnode" >> $TEMPCONF
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>