All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego]  [PATCH v2] Improve test cases for command ethtool.
@ 2019-02-10  8:35 Zheng Ruoqin
  2019-02-18 20:49 ` Tim.Bird
  0 siblings, 1 reply; 2+ messages in thread
From: Zheng Ruoqin @ 2019-02-10  8:35 UTC (permalink / raw)
  To: fuego

1. Check ETHERNET_DEVICE_NAME value before testing ethtool really

2. Put ETHERNET_DEVICE_NAME detection to specific function in library

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
---
 scripts/fuego_board_function_lib.sh              | 16 ++++++++++++++++
 tests/Functional.ethtool/fuego_test.sh           |  1 +
 tests/Functional.ethtool/tests/ethtool_driver.sh | 18 ++++++++----------
 tests/Functional.ethtool/tests/ethtool_show.sh   | 17 +++++++----------
 4 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/scripts/fuego_board_function_lib.sh b/scripts/fuego_board_function_lib.sh
index 4c29bf3..ef80d56 100644
--- a/scripts/fuego_board_function_lib.sh
+++ b/scripts/fuego_board_function_lib.sh
@@ -48,3 +48,19 @@ exec_service_on_target() {
         /etc/init.d/$1 $2
     fi
 }
+
+# detect_active_eth_device
+#   Detect the name of actived ethernet device
+# returns: name of actived ethernet device
+detect_active_eth_device() {
+    ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
+    for line in $(cat driver_list)
+    do
+        if ethtool $line | grep "baseT" > /dev/null
+        then
+            echo "$line"
+            return
+        fi
+    done
+    echo "have no Ethernet device"
+}
diff --git a/tests/Functional.ethtool/fuego_test.sh b/tests/Functional.ethtool/fuego_test.sh
index 233d367..d41855d 100644
--- a/tests/Functional.ethtool/fuego_test.sh
+++ b/tests/Functional.ethtool/fuego_test.sh
@@ -5,6 +5,7 @@ function test_pre_check {
 
 function test_deploy {
     put $TEST_HOME/ethtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
     put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
 }
 
diff --git a/tests/Functional.ethtool/tests/ethtool_driver.sh b/tests/Functional.ethtool/tests/ethtool_driver.sh
index 6f6d576..e881b0c 100644
--- a/tests/Functional.ethtool/tests/ethtool_driver.sh
+++ b/tests/Functional.ethtool/tests/ethtool_driver.sh
@@ -5,17 +5,15 @@
 
 test="driver"
 
-ETHERNET_DEVICE_NAME="have no Ethernet device"
-ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
+. ./fuego_board_function_lib.sh
 
-for line in $(cat driver_list)
-do
-    if ethtool $line | grep "baseT"
-    then
-        ETHERNET_DEVICE_NAME=$line
-        break
-    fi
-done
+ETHERNET_DEVICE_NAME=$(detect_active_eth_device)
+
+if [ "${ETHERNET_DEVICE_NAME}x" = "have no Ethernet devicex" ]
+then
+    echo " -> $test: TEST-FAIL"
+    exit 1
+fi
 
 if ethtool -i $ETHERNET_DEVICE_NAME | grep driver
 then
diff --git a/tests/Functional.ethtool/tests/ethtool_show.sh b/tests/Functional.ethtool/tests/ethtool_show.sh
index 98abe40..e56a4ac 100644
--- a/tests/Functional.ethtool/tests/ethtool_show.sh
+++ b/tests/Functional.ethtool/tests/ethtool_show.sh
@@ -5,18 +5,15 @@
 
 test="show"
 
-ETHERNET_DEVICE_NAME="have no Ethernet device"
-ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
+. ./fuego_board_function_lib.sh
 
-for line in $(cat driver_list)
-do
-    if ethtool $line | grep "baseT"
-    then
-        ETHERNET_DEVICE_NAME=$line
-        break
-    fi
-done
+ETHERNET_DEVICE_NAME=$(detect_active_eth_device)
 
+if [ "${ETHERNET_DEVICE_NAME}x" = "have no Ethernet devicex" ]
+then
+    echo " -> $test: TEST-FAIL"
+    exit 1
+fi
 
 if ethtool $ETHERNET_DEVICE_NAME | grep "Settings for"
 then
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Fuego] [PATCH v2] Improve test cases for command ethtool.
  2019-02-10  8:35 [Fuego] [PATCH v2] Improve test cases for command ethtool Zheng Ruoqin
@ 2019-02-18 20:49 ` Tim.Bird
  0 siblings, 0 replies; 2+ messages in thread
From: Tim.Bird @ 2019-02-18 20:49 UTC (permalink / raw)
  To: zhengrq.fnst, fuego

Thanks.  Applied and pushed to fuegotest/fuego-core next branch.
 -- Tim


> -----Original Message-----
> From: Zheng Ruoqin
> 1. Check ETHERNET_DEVICE_NAME value before testing ethtool really
> 
> 2. Put ETHERNET_DEVICE_NAME detection to specific function in library
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
> ---
>  scripts/fuego_board_function_lib.sh              | 16 ++++++++++++++++
>  tests/Functional.ethtool/fuego_test.sh           |  1 +
>  tests/Functional.ethtool/tests/ethtool_driver.sh | 18 ++++++++----------
>  tests/Functional.ethtool/tests/ethtool_show.sh   | 17 +++++++----------
>  4 files changed, 32 insertions(+), 20 deletions(-)
> 
> diff --git a/scripts/fuego_board_function_lib.sh
> b/scripts/fuego_board_function_lib.sh
> index 4c29bf3..ef80d56 100644
> --- a/scripts/fuego_board_function_lib.sh
> +++ b/scripts/fuego_board_function_lib.sh
> @@ -48,3 +48,19 @@ exec_service_on_target() {
>          /etc/init.d/$1 $2
>      fi
>  }
> +
> +# detect_active_eth_device
> +#   Detect the name of actived ethernet device
> +# returns: name of actived ethernet device
> +detect_active_eth_device() {
> +    ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
> +    for line in $(cat driver_list)
> +    do
> +        if ethtool $line | grep "baseT" > /dev/null
> +        then
> +            echo "$line"
> +            return
> +        fi
> +    done
> +    echo "have no Ethernet device"
> +}
> diff --git a/tests/Functional.ethtool/fuego_test.sh
> b/tests/Functional.ethtool/fuego_test.sh
> index 233d367..d41855d 100644
> --- a/tests/Functional.ethtool/fuego_test.sh
> +++ b/tests/Functional.ethtool/fuego_test.sh
> @@ -5,6 +5,7 @@ function test_pre_check {
> 
>  function test_deploy {
>      put $TEST_HOME/ethtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put $FUEGO_CORE/scripts/fuego_board_function_lib.sh
> $BOARD_TESTDIR/fuego.$TESTDIR
>      put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
>  }
> 
> diff --git a/tests/Functional.ethtool/tests/ethtool_driver.sh
> b/tests/Functional.ethtool/tests/ethtool_driver.sh
> index 6f6d576..e881b0c 100644
> --- a/tests/Functional.ethtool/tests/ethtool_driver.sh
> +++ b/tests/Functional.ethtool/tests/ethtool_driver.sh
> @@ -5,17 +5,15 @@
> 
>  test="driver"
> 
> -ETHERNET_DEVICE_NAME="have no Ethernet device"
> -ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
> +. ./fuego_board_function_lib.sh
> 
> -for line in $(cat driver_list)
> -do
> -    if ethtool $line | grep "baseT"
> -    then
> -        ETHERNET_DEVICE_NAME=$line
> -        break
> -    fi
> -done
> +ETHERNET_DEVICE_NAME=$(detect_active_eth_device)
> +
> +if [ "${ETHERNET_DEVICE_NAME}x" = "have no Ethernet devicex" ]
> +then
> +    echo " -> $test: TEST-FAIL"
> +    exit 1
> +fi
> 
>  if ethtool -i $ETHERNET_DEVICE_NAME | grep driver
>  then
> diff --git a/tests/Functional.ethtool/tests/ethtool_show.sh
> b/tests/Functional.ethtool/tests/ethtool_show.sh
> index 98abe40..e56a4ac 100644
> --- a/tests/Functional.ethtool/tests/ethtool_show.sh
> +++ b/tests/Functional.ethtool/tests/ethtool_show.sh
> @@ -5,18 +5,15 @@
> 
>  test="show"
> 
> -ETHERNET_DEVICE_NAME="have no Ethernet device"
> -ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
> +. ./fuego_board_function_lib.sh
> 
> -for line in $(cat driver_list)
> -do
> -    if ethtool $line | grep "baseT"
> -    then
> -        ETHERNET_DEVICE_NAME=$line
> -        break
> -    fi
> -done
> +ETHERNET_DEVICE_NAME=$(detect_active_eth_device)
> 
> +if [ "${ETHERNET_DEVICE_NAME}x" = "have no Ethernet devicex" ]
> +then
> +    echo " -> $test: TEST-FAIL"
> +    exit 1
> +fi
> 
>  if ethtool $ETHERNET_DEVICE_NAME | grep "Settings for"
>  then
> --
> 1.8.3.1
> 
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-18 20:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-10  8:35 [Fuego] [PATCH v2] Improve test cases for command ethtool Zheng Ruoqin
2019-02-18 20:49 ` Tim.Bird

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.