Skip to contentSkip to conversation

Add test cases for commands of busybox as follows: ash bunzip2 free wget

PATCH In review Wang Mingyu 3 participants 6 messages May 18, 2018 – Jun 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add test cases for commands of busybox as follows: ash bunzip2 free wget

---
 engine/tests/Functional.busybox/busybox.tar.gz     | Bin 0 -> 171 bytes
 .../Functional.busybox/testsuits/busybox_ash.sh    |  15 ++++++++++++++
 .../testsuits/busybox_bunzip2.sh                   |  12 +++++++++++
 .../Functional.busybox/testsuits/busybox_free.sh   |  10 ++++++++++
 .../Functional.busybox/testsuits/busybox_wget.sh   |  22 +++++++++++++++++++++
 5 files changed, 59 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/busybox.tar.gz
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_ash.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_free.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_wget.sh
engine/tests/Functional.busybox/busybox.tar.gz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..0bdac1768d26a5f9ec1583e93a3632d978808960
GIT binary patch
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +15 -0
new file mode 100644
index 0000000..47cea2d
@@ -0,0 +1,15 @@
+#!/bin/bash
+workdir=$(pwd)
+test="ash"
+
+expect <<-EOF
+spawn busybox ash
+expect "*# "
+send_user " -> $test: Opened ash shell succeeded.\n"
+send "busybox pwd\r"
+expect "$workdir"
+send_user " -> $test: Executed pwd command ash shell succeeded.\n"
+send "exit\r"
+send_user " -> $test: Closing ash shell succeeded.\n pass $test\n"
+expect eof
+EOF
engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh new file +12 -0
new file mode 100644
index 0000000..0704b9a
@@ -0,0 +1,12 @@
+#!/bin/bash
+test="bunzip2"
+
+echo "This is a test file">test1
+bzip2 test1
+if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm -rf test1.bz2;
engine/tests/Functional.busybox/testsuits/busybox_free.sh new file +10 -0
new file mode 100644
index 0000000..4b5b192
@@ -0,0 +1,10 @@
+#!/bin/bash
+test="free"
+
+busybox free
+if [ `echo $?` == 0 ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +22 -0
new file mode 100644
index 0000000..90fa83d
@@ -0,0 +1,22 @@
+#!/bin/bash
+test="wget"
+
+if [ -f /home/test/readme.txt ]; then rm -f /home/test/readme.txt ; fi
+busybox wget http://$test_tcpip_host:$test_port_host/$httproot_dir_host -P /home/test
+if ls  /home/test/ | grep ".*readme.*"
+then
+    echo "$test: ls  /home/test/ executed."
+else
+    echo "$test: ls  /home/test/ failed."
+fi;
+if cat /home/test/readme.txt | grep ".*jenkins.*"
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm /home/test/readme.txt
+ls /
+
+
+
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Tim,

I'm very sorry, there is a problem with the previous patch, please ignore it. The modified patch has been sent as an attachment. Please confirm it.

Best regards.

-----Original Message-----
From: Wang, Mingyu/王 鸣瑜
Sent: Friday, May 18, 2018 10:41 PM
To: [email protected]
Cc: Wang, Mingyu/王 鸣瑜 <[email protected]>
Subject: [PATCH] Add test cases for commands of busybox as follows: ash bunzip2 free wget

---
 engine/tests/Functional.busybox/busybox.tar.gz     | Bin 0 -> 171 bytes
 .../Functional.busybox/testsuits/busybox_ash.sh    |  15 ++++++++++++++
 .../testsuits/busybox_bunzip2.sh                   |  12 +++++++++++
 .../Functional.busybox/testsuits/busybox_free.sh   |  10 ++++++++++
 .../Functional.busybox/testsuits/busybox_wget.sh   |  22 +++++++++++++++++++++
 5 files changed, 59 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/busybox.tar.gz
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_ash.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_free.sh
 create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_wget.sh
engine/tests/Functional.busybox/busybox.tar.gz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..0bdac1768d26a5f9ec1583e93a3632d978808960
GIT binary patch
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +15 -0
new file mode 100644
index 0000000..47cea2d
@@ -0,0 +1,15 @@
+#!/bin/bash
+workdir=$(pwd)
+test="ash"
+
+expect <<-EOF
+spawn busybox ash
+expect "*# "
+send_user " -> $test: Opened ash shell succeeded.\n"
+send "busybox pwd\r"
+expect "$workdir"
+send_user " -> $test: Executed pwd command ash shell succeeded.\n"
+send "exit\r"
+send_user " -> $test: Closing ash shell succeeded.\n pass $test\n"
+expect eof
+EOF
engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh new file +11 -0
new file mode 100644
index 0000000..0704b9a
@@ -0,0 +1,12 @@
+#!/bin/bash
+test="bunzip2"
+
+echo "This is a test file">test1
+bzip2 test1
+if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ] then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm -rf test1.bz2;
engine/tests/Functional.busybox/testsuits/busybox_free.sh new file +10 -0
new file mode 100644
index 0000000..4b5b192
@@ -0,0 +1,10 @@
+#!/bin/bash
+test="free"
+
+busybox free
+if [ `echo $?` == 0 ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +22 -0
new file mode 100644
index 0000000..90fa83d
@@ -0,0 +1,22 @@
+#!/bin/bash
+test="wget"
+
+if [ -f /home/test/readme.txt ]; then rm -f /home/test/readme.txt ; fi 
+busybox wget http://$test_tcpip_host:$test_port_host/$httproot_dir_host 
+-P /home/test if ls  /home/test/ | grep ".*readme.*"
+then
+    echo "$test: ls  /home/test/ executed."
+else
+    echo "$test: ls  /home/test/ failed."
+fi;
+if cat /home/test/readme.txt | grep ".*jenkins.*"
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm /home/test/readme.txt
+ls /
+
+
+

--
1.8.3.1

From 0ccae08833ba94ae80a95ce22795488953c25e33 Mon Sep 17 00:00:00 2001
From: Wang Mingyu <[email protected]>
Date: Fri, 18 May 2018 09:21:30 -0700
Subject: [PATCH] Add test cases for commands of busybox as follows: ash,
bunzip2, free, wget.

---
 engine/tests/Functional.busybox/busybox.tar.gz | Bin 171 -> 215 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
engine/tests/Functional.busybox/busybox.tar.gz binary +0 -0
index 0bdac1768d26a5f9ec1583e93a3632d978808960..b7fc0ed8dfba76a4740625a9ff60e71545c46889 100644
GIT binary patch
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 5 lines

-----Original Message-----
From: Wang, Mingyu

I'm very sorry, there is a problem with the previous patch, please ignore it. The modified patch has been sent as an attachment. Please confirm it.

The attached patch only contains busybox.tar.gz. The original message contained busybox.tar.gz, as well as 4 test scripts. I thought the new patch (the attachment) would be a replacement. In the attachment, the patch is inside a directory busybox-scripts, which is not referenced in fuego_test.sh. I think there is something wrong here. I would recommend getting rid of busybox.tar.gz, and not putting busybox_test.sh in a sub-directory.

Quoted 55 lines

Best regards.

-----Original Message-----
From: Wang, Mingyu/王 鸣瑜
Sent: Friday, May 18, 2018 10:41 PM
To: [email protected]
Cc: Wang, Mingyu/王 鸣瑜 <[email protected]>
Subject: [PATCH] Add test cases for commands of busybox as follows: ash bunzip2 free wget

---
 engine/tests/Functional.busybox/busybox.tar.gz     | Bin 0 -> 171 bytes
 .../Functional.busybox/testsuits/busybox_ash.sh    |  15 ++++++++++++++
 .../testsuits/busybox_bunzip2.sh                   |  12 +++++++++++
 .../Functional.busybox/testsuits/busybox_free.sh   |  10 ++++++++++
 .../Functional.busybox/testsuits/busybox_wget.sh   |  22
+++++++++++++++++++++
 5 files changed, 59 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/busybox.tar.gz
 create mode 100644
engine/tests/Functional.busybox/testsuits/busybox_ash.sh
 create mode 100644
engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
 create mode 100644
engine/tests/Functional.busybox/testsuits/busybox_free.sh
 create mode 100644

engine/tests/Functional.busybox/testsuits/busybox_wget.sh

engine/tests/Functional.busybox/busybox.tar.gz new file +0 -0
new file mode 100644

index 0000000000000000000000000000000000000000..0bdac1768d26a5f9ec1583e93 a3632d978808960
GIT binary patch
literal 171 zcmb2|=3qE<@m~}J^V>_-e1{AKSx3@9aRbp6nO3!Qy?Lt?N})6y;1q#Tf- @u3%Udz z{hy_o)~$I>_v5=mZzr|Q=qn6~Hi*1!vi{7qnck~U?bG$B=YjLQ&U23PxCsXmK`

Quoted 1 line

2

z#;!=0vx-Z~%jf@+->N-lKG*f5f$@iR;{K?dkMHRA-
)Qk<x`ns=mXyLNd#~5dU|YN2
UR+<4B{JY2O#?pI`L4$z-0L$P@YXATM

literal 0
HcmV?d00001

engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +0 -0
new file mode 100644
index 0000000..47cea2d

engine/tests/Functional.busybox/testsuits/busybox_ash.sh line 5

Quoted 5 lines
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +5 -0
@@ -0,0 +1,15 @@
+#!/bin/bash
+workdir=$(pwd)
+test="ash"
+
+expect <<-EOF

This test requires the tool 'expect', which a board may not have.

Please add a test_pre_check function to your fuego_test.sh, with a dependency check for this.

Like so:
function test_pre_check {
is_on_target_path expect PROGRAM_EXPECT
assert_define PROGRAM_EXPECT "Missing required program 'expect' on board"
}

Quoted 52 lines
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +10 -0
+spawn busybox ash
+expect "*# "
+send_user " -> $test: Opened ash shell succeeded.\n"
+send "busybox pwd\r"
+expect "$workdir"
+send_user " -> $test: Executed pwd command ash shell succeeded.\n"
+send "exit\r"
+send_user " -> $test: Closing ash shell succeeded.\n pass $test\n"
+expect eof
+EOF
engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh new file +11 -0
new file mode 100644
index 0000000..0704b9a
@@ -0,0 +1,12 @@
+#!/bin/bash
+test="bunzip2"
+
+echo "This is a test file">test1
+bzip2 test1
+if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ] then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm -rf test1.bz2;
engine/tests/Functional.busybox/testsuits/busybox_free.sh new file +10 -0
new file mode 100644
index 0000000..4b5b192
@@ -0,0 +1,10 @@
+#!/bin/bash
+test="free"
+
+busybox free
+if [ `echo $?` == 0 ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +0 -0
new file mode 100644
index 0000000..90fa83d

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 4

Quoted 4 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +4 -0
@@ -0,0 +1,22 @@
+#!/bin/bash
+test="wget"
+
+if [ -f /home/test/readme.txt ]; then rm -f /home/test/readme.txt ; fi

You should not use a hardcoded path for this: /home/test. It would be better to use a relative path, based on the current working directory. Different boards will have different BOARD_TESTDIR directories, where the test will run. Not every board will have a /home/test directory. Or, a board might have a /home/test directory that is unrelated to Fuego, and we should not disturb it.

Quoted 2 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +1 -0
+busybox wget

http://$test_tcpip_host:$test_port_host/$httproot_dir_host

httproot_dir_host is only used once. (maybe it is used in other scripts you haven't submitted yet). I think using the path here would be better. (that is, use "fuego/userContent/readme.txt" instead of the variable httproot_dir_host.

I can't find anywhere that SRV_PORT is set on any of my board, or in Fuego. Am I missing something? Is this a new required board variable?

Quoted 4 lines

+-P /home/test if ls /home/test/ | grep ".*readme.*"

engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +3 -0
+then
+    echo "$test: ls  /home/test/ executed."
+else

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 19

Quoted 10 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +10 -0
+    echo "$test: ls  /home/test/ failed."
+fi;
+if cat /home/test/readme.txt | grep ".*jenkins.*"
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm /home/test/readme.txt
+ls /

What is this final 'ls' for?

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 21

Quoted 3 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +3 -0
+
+
+

Why are there extra lines here?

Overall, pretty good. I think I would prefer something more unique to recognize a passing test, than the string "pass". This could end up matching something like "password", or "passing", in test output. (It is used in log_compare in your
fuego_test.sh script). I would recommend something
that is unlikely to appear in test output - maybe TPASS, or something like that.

In general, I think the output could be improved a bit. We have started adding the ability to split the test output into testcase results. It is helpful if a testcase identifier is available in the line used to report the result for each testcase. Many tests use numbers, but my personal preference is to use a descriptive string, that is unique throughout the test suite.

I can discuss this more if you'd like. I gave a presentation which included some tips in this area. You can find a link to it here:
http://fuegotest.org/wiki/Presentations

I think it would be good to review the output you are presenting, modify it a bit, and write a parser.py for your output, so you could get more detailed results (per-testcase) from the Jenkins interface. I can help you with this if you'd like.
-- Tim

#3 lore raw

Hi Tim,

Thank you for your comments.
I've confirmed all of them.
I want to submit patch again after all the comments are solved.

Quoted 6 lines

The attached patch only contains busybox.tar.gz. The original message contained busybox.tar.gz, as well as 4 test scripts. I thought the new patch (the attachment) would be a replacement. In the attachment, the patch is inside a directory busybox- scripts, which is not referenced in fuego_test.sh. I think there is something wrong here. I would recommend getting rid of busybox.tar.gz, and not putting busybox_test.sh in a sub-directory.

The tarball is been deleted.

Quoted 8 lines

This test requires the tool 'expect', which a board may not have. Please add a test_pre_check function to your fuego_test.sh, with a dependency check for this.
Like so:
function test_pre_check {
is_on_target_path expect PROGRAM_EXPECT
assert_define PROGRAM_EXPECT "Missing required program 'expect' on board"
}

I added a judgement of whether there is the expect on board or not, and skipped some test cases if the expect is not exist. This judgment may also be used in other tests, which can be considered as a general function of fuego.

Quoted 10 lines
Quoted 10 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +3 -0
new file mode 100644
index 0000000..90fa83d
@@ -0,0 +1,22 @@
+#!/bin/bash
+test="wget"
+
Quoted 8 lines

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 5

Quoted 2 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +2 -0
+if [ -f /home/test/readme.txt ]; then rm -f /home/test/readme.txt ; 
+fi

You should not use a hardcoded path for this: /home/test. It would be better to use a relative path, based on the current working directory.
Different boards will have different BOARD_TESTDIR directories, where the test will run. Not every board will have a /home/test directory.
Or, a board might have a /home/test directory that is unrelated to Fuego, and we should not disturb it.

I have been modified it by using a relative path.

Quoted 5 lines
Quoted 2 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +1 -0
+busybox wget

http://$test_tcpip_host:$test_port_host/$httproot_dir_host

httproot_dir_host is only used once. (maybe it is used in other scripts you haven't submitted yet). I think using the path here would be better.
(that is, use "fuego/userContent/readme.txt" instead of the variable httproot_dir_host.

The variable httproot_dir_host is only used once by test of wget.
I've been used "fuego/userContent/readme.txt" instead of the variable httproot_dir_host.

Quoted 2 lines

I can't find anywhere that SRV_PORT is set on any of my board, or in Fuego. Am I missing something? Is this a new required board variable?

In addition to the IP address, also requires the specified port to access to fuego's readme.txt. But there is no such variable in Fuego. So I added a SRV_PORT in the board settings just like SRV_IP. If you have any good advice to me, it will be helpful. (In the all test cases of busybox, there is only one case who need the setting of port).

Quoted 3 lines

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 19

Quoted 2 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +2 -0
+rm /home/test/readme.txt
+ls /

What is this final 'ls' for?

The test suite was transplanted from other platforms. According to the survey, now the 'ls' was not meaningful and I will delete it from this test case.

Quoted 4 lines

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 21

Quoted 3 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +3 -0
+
+
+

Why are there extra lines here?

The habit of writing sh scripts is not good, and I'm very sorry. The final blank lines of the sh script have been deleted.

Quoted 8 lines

Overall, pretty good. I think I would prefer something more unique to recognize a passing test, than the string "pass". This could end up matching something like "password", or "passing", in test output. (It is used in log_compare in your
fuego_test.sh script). I would recommend something
that is unlikely to appear in test output - maybe TPASS, or something like that. In general, I think the output could be improved a bit. We have started adding the ability to split the test output into testcase results. It is helpful if a testcase identifier is available in the line used to report the result for each testcase.

Quoted 8 lines

Many tests use numbers, but my personal preference is to use a descriptive string, that is unique throughout the test suite.
I can discuss this more if you'd like. I gave a presentation which included some tips in this area. You can find a link to it here:
http://fuegotest.org/wiki/Presentations
I think it would be good to review the output you are presenting, modify it a bit, and write a parser.py for your output, so you could get more detailed results (per-testcase) from the Jenkins interface. I can help you with this if you'd like.

Thank you for your advice and I have been used parser.py to improve the output of the test.

-- Wangmy.

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Saturday, May 19, 2018 9:57 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] Add test cases for commands of busybox as follows: ash bunzip2 free wget

Quoted 5 lines

-----Original Message-----
From: Wang, Mingyu

I'm very sorry, there is a problem with the previous patch, please ignore it. The modified patch has been sent as an attachment. Please confirm it.

The attached patch only contains busybox.tar.gz. The original message contained busybox.tar.gz, as well as 4 test scripts. I thought the new patch (the attachment) would be a replacement. In the attachment, the patch is inside a directory busybox-scripts, which is not referenced in fuego_test.sh. I think there is something wrong here. I would recommend getting rid of busybox.tar.gz, and not putting busybox_test.sh in a sub-directory.

Quoted 56 lines

Best regards.

-----Original Message-----
From: Wang, Mingyu/王 鸣瑜
Sent: Friday, May 18, 2018 10:41 PM
To: [email protected]
Cc: Wang, Mingyu/王 鸣瑜 <[email protected]>
Subject: [PATCH] Add test cases for commands of busybox as follows:
ash
bunzip2 free wget

---
 engine/tests/Functional.busybox/busybox.tar.gz     | Bin 0 -> 171 bytes
 .../Functional.busybox/testsuits/busybox_ash.sh    |  15 ++++++++++++++
 .../testsuits/busybox_bunzip2.sh                   |  12 +++++++++++
 .../Functional.busybox/testsuits/busybox_free.sh   |  10 ++++++++++
 .../Functional.busybox/testsuits/busybox_wget.sh   |  22
+++++++++++++++++++++
 5 files changed, 59 insertions(+)
 create mode 100644 engine/tests/Functional.busybox/busybox.tar.gz
 create mode 100644
engine/tests/Functional.busybox/testsuits/busybox_ash.sh
 create mode 100644
engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh
 create mode 100644
engine/tests/Functional.busybox/testsuits/busybox_free.sh
 create mode 100644

engine/tests/Functional.busybox/testsuits/busybox_wget.sh

engine/tests/Functional.busybox/busybox.tar.gz new file +0 -0
new file mode 100644

index 0000000000000000000000000000000000000000..0bdac1768d26a5f9ec1583e93 a3632d978808960
GIT binary patch
literal 171 zcmb2|=3qE<@m~}J^V>_-e1{AKSx3@9aRbp6nO3!Qy?Lt?N})6y;1q#Tf- @u3%Udz z{hy_o)~$I>_v5=mZzr|Q=qn6~Hi*1!vi{7qnck~U?bG$B=YjLQ&U23PxCsXmK`

Quoted 1 line

2

z#;!=0vx-Z~%jf@+->N-lKG*f5f$@iR;{K?dkMHRA-
)Qk<x`ns=mXyLNd#~5dU|YN2
UR+<4B{JY2O#?pI`L4$z-0L$P@YXATM

literal 0
HcmV?d00001

engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +0 -0
new file mode 100644
index 0000000..47cea2d

engine/tests/Functional.busybox/testsuits/busybox_ash.sh line 5

Quoted 5 lines
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +5 -0
@@ -0,0 +1,15 @@
+#!/bin/bash
+workdir=$(pwd)
+test="ash"
+
+expect <<-EOF

This test requires the tool 'expect', which a board may not have.

Please add a test_pre_check function to your fuego_test.sh, with a dependency check for this.

Like so:
function test_pre_check {
is_on_target_path expect PROGRAM_EXPECT
assert_define PROGRAM_EXPECT "Missing required program 'expect' on board"
}

Quoted 53 lines
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +10 -0
+spawn busybox ash
+expect "*# "
+send_user " -> $test: Opened ash shell succeeded.\n"
+send "busybox pwd\r"
+expect "$workdir"
+send_user " -> $test: Executed pwd command ash shell succeeded.\n"
+send "exit\r"
+send_user " -> $test: Closing ash shell succeeded.\n pass $test\n"
+expect eof
+EOF
(quoted diff) +0 -0

a/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh b/engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh new file mode 100644
index 0000000..0704b9a

engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh new file +11 -0
@@ -0,0 +1,12 @@
+#!/bin/bash
+test="bunzip2"
+
+echo "This is a test file">test1
+bzip2 test1
+if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ] then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm -rf test1.bz2;
engine/tests/Functional.busybox/testsuits/busybox_free.sh new file +10 -0
new file mode 100644
index 0000000..4b5b192
@@ -0,0 +1,10 @@
+#!/bin/bash
+test="free"
+
+busybox free
+if [ `echo $?` == 0 ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +0 -0
new file mode 100644
index 0000000..90fa83d

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 5

Quoted 5 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +5 -0
@@ -0,0 +1,22 @@
+#!/bin/bash
+test="wget"
+
+if [ -f /home/test/readme.txt ]; then rm -f /home/test/readme.txt ; 
+fi

You should not use a hardcoded path for this: /home/test. It would be better to use a relative path, based on the current working directory. Different boards will have different BOARD_TESTDIR directories, where the test will run. Not every board will have a /home/test directory. Or, a board might have a /home/test directory that is unrelated to Fuego, and we should not disturb it.

Quoted 2 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +1 -0
+busybox wget

http://$test_tcpip_host:$test_port_host/$httproot_dir_host

httproot_dir_host is only used once. (maybe it is used in other scripts you haven't submitted yet). I think using the path here would be better. (that is, use "fuego/userContent/readme.txt" instead of the variable httproot_dir_host.

I can't find anywhere that SRV_PORT is set on any of my board, or in Fuego. Am I missing something? Is this a new required board variable?

Quoted 4 lines

+-P /home/test if ls /home/test/ | grep ".*readme.*"

engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +3 -0
+then
+    echo "$test: ls  /home/test/ executed."
+else

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 19

Quoted 10 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +10 -0
+    echo "$test: ls  /home/test/ failed."
+fi;
+if cat /home/test/readme.txt | grep ".*jenkins.*"
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm /home/test/readme.txt
+ls /

What is this final 'ls' for?

engine/tests/Functional.busybox/testsuits/busybox_wget.sh line 21

Quoted 3 lines
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +3 -0
+
+
+

Why are there extra lines here?

Overall, pretty good. I think I would prefer something more unique to recognize a passing test, than the string "pass". This could end up matching something like "password", or "passing", in test output. (It is used in log_compare in your
fuego_test.sh script). I would recommend something
that is unlikely to appear in test output - maybe TPASS, or something like that.

In general, I think the output could be improved a bit. We have started adding the ability to split the test output into testcase results. It is helpful if a testcase identifier is available in the line used to report the result for each testcase. Many tests use numbers, but my personal preference is to use a descriptive string, that is unique throughout the test suite.

I can discuss this more if you'd like. I gave a presentation which included some tips in this area. You can find a link to it here:
http://fuegotest.org/wiki/Presentations

I think it would be good to review the output you are presenting, modify it a bit, and write a parser.py for your output, so you could get more detailed results (per-testcase) from the Jenkins interface. I can help you with this if you'd like.
-- Tim

#4 lore raw
Quoted 7 lines

-----Original Message-----
From: Wang, Mingyu [mailto:[email protected]] Thank you for your comments.
I've confirmed all of them.
I want to submit patch again after all the comments are solved.

Sounds good. Please don't hesitate to ask me if you have more questions.
-- Tim

#5 lore raw
In reply to Wang Mingyu

Dear Wang Mingyu and all,

I have a confusion about the method for adding tests for testing busybox.

Actually, the test code for many busybox commands have existed into testsuite folder

of busybox source code. You can see that at:

https://github.com/mirror/busybox/tree/master/testsuite

We can build the tests from upstream source, then install and run the tests in our target board. I see the tests have been wrote very detail and I think we can reuse them instead of writing them from scratch by our-self.

Could you let me know what do you think?

Best regards,
Tuyen

Quoted 110 lines · Wang Mingyu
---
  engine/tests/Functional.busybox/busybox.tar.gz     | Bin 0 -> 171 bytes
  .../Functional.busybox/testsuits/busybox_ash.sh    |  15 ++++++++++++++
  .../testsuits/busybox_bunzip2.sh                   |  12 +++++++++++
  .../Functional.busybox/testsuits/busybox_free.sh   |  10 ++++++++++
  .../Functional.busybox/testsuits/busybox_wget.sh   |  22 +++++++++++++++++++++
  5 files changed, 59 insertions(+)

create mode 100644 engine/tests/Functional.busybox/busybox.tar.gz create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_ash.sh create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_free.sh create mode 100644 engine/tests/Functional.busybox/testsuits/busybox_wget.sh

engine/tests/Functional.busybox/busybox.tar.gz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..0bdac1768d26a5f9ec1583e93a3632d978808960
GIT binary patch
engine/tests/Functional.busybox/testsuits/busybox_ash.sh new file +15 -0
new file mode 100644
index 0000000..47cea2d
@@ -0,0 +1,15 @@
+#!/bin/bash
+workdir=$(pwd)
+test="ash"
+
+expect <<-EOF
+spawn busybox ash
+expect "*# "
+send_user " -> $test: Opened ash shell succeeded.\n"
+send "busybox pwd\r"
+expect "$workdir"
+send_user " -> $test: Executed pwd command ash shell succeeded.\n"
+send "exit\r"
+send_user " -> $test: Closing ash shell succeeded.\n pass $test\n"
+expect eof
+EOF
engine/tests/Functional.busybox/testsuits/busybox_bunzip2.sh new file +12 -0
new file mode 100644
index 0000000..0704b9a
@@ -0,0 +1,12 @@
+#!/bin/bash
+test="bunzip2"
+
+echo "This is a test file">test1
+bzip2 test1
+if [ "`busybox bunzip2 -c test1.bz2`" == "This is a test file" ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm -rf test1.bz2;
engine/tests/Functional.busybox/testsuits/busybox_free.sh new file +10 -0
new file mode 100644
index 0000000..4b5b192
@@ -0,0 +1,10 @@
+#!/bin/bash
+test="free"
+
+busybox free
+if [ `echo $?` == 0 ]
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
engine/tests/Functional.busybox/testsuits/busybox_wget.sh new file +22 -0
new file mode 100644
index 0000000..90fa83d
@@ -0,0 +1,22 @@
+#!/bin/bash
+test="wget"
+
+if [ -f /home/test/readme.txt ]; then rm -f /home/test/readme.txt ; fi
+busybox wget http://$test_tcpip_host:$test_port_host/$httproot_dir_host -P /home/test
+if ls  /home/test/ | grep ".*readme.*"
+then
+    echo "$test: ls  /home/test/ executed."
+else
+    echo "$test: ls  /home/test/ failed."
+fi;
+if cat /home/test/readme.txt | grep ".*jenkins.*"
+then
+    echo "$test: test cases succeeded.\n pass $test"
+else
+    echo "$test: test cases failed."
+fi;
+rm /home/test/readme.txt
+ls /
+
+
+
Signature · 2 lines
This mail was scanned by BitDefender
For more information please visit http://www.bitdefender.com