From ca705e4916a899f669c087f6d793de9db45eaeeb Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Sat, 5 Oct 2013 10:34:01 +0300 Subject: ubuntu: move from bzr to git repositories, clean up descriptions Signed-off-by: Milosz Wasilewski Signed-off-by: Fathi Boudra --- ubuntu/aapits.yaml | 2 +- ubuntu/acpi-abat.yaml | 2 +- ubuntu/acpica.yaml | 2 +- ubuntu/bluetooth-enablement.yaml | 10 +- ubuntu/bootchart-install.yaml | 2 +- ubuntu/bootchart.yaml | 2 +- ubuntu/device-tree.yaml | 8 +- ubuntu/e2eaudiotest.yaml | 2 +- ubuntu/fwts.yaml | 2 +- ubuntu/gatortests.yaml | 2 +- ubuntu/kvm.yaml | 2 +- ubuntu/latency-test.yaml | 2 +- ubuntu/leb-basic-graphics.yaml | 2 +- ubuntu/libhugetlbfs.yaml | 2 +- ubuntu/ltp-network.yaml | 2 +- ubuntu/ltp-realtime.yaml | 2 +- ubuntu/ltp.yaml | 2 +- ubuntu/network-tests-basic.yaml | 2 +- ubuntu/perf.yaml | 17 +- ubuntu/pwrmgmt.yaml | 2 +- ubuntu/rt-hackbench.yaml | 2 +- ubuntu/rt-ltp.yaml | 2 +- ubuntu/scripts/basic-graphics-test.sh | 170 ++++++++++++++++ ubuntu/scripts/bluetooth-enablement-test.sh | 199 +++++++++++++++++++ ubuntu/scripts/device-tree.sh | 72 +++++++ ubuntu/scripts/include/sh-test-lib | 62 ++++++ ubuntu/scripts/run-perf-test.sh | 84 ++++++++ ubuntu/scripts/wifi-enablement-test.sh | 289 ++++++++++++++++++++++++++++ ubuntu/smoke-tests-basic.yaml | 2 +- ubuntu/wifi-enablement.yaml | 13 +- 30 files changed, 928 insertions(+), 36 deletions(-) create mode 100755 ubuntu/scripts/basic-graphics-test.sh create mode 100755 ubuntu/scripts/bluetooth-enablement-test.sh create mode 100755 ubuntu/scripts/device-tree.sh create mode 100644 ubuntu/scripts/include/sh-test-lib create mode 100755 ubuntu/scripts/run-perf-test.sh create mode 100755 ubuntu/scripts/wifi-enablement-test.sh diff --git a/ubuntu/aapits.yaml b/ubuntu/aapits.yaml index adf3211..6fc2de7 100644 --- a/ubuntu/aapits.yaml +++ b/ubuntu/aapits.yaml @@ -1,7 +1,7 @@ metadata: name: aapits format: "Lava-Test-Shell Test Definition 1.0" - description: "ACPI API test suite on ubuntu." + description: "Run ACPI API test suite" install: git-repos: diff --git a/ubuntu/acpi-abat.yaml b/ubuntu/acpi-abat.yaml index f48d6bb..4e26180 100644 --- a/ubuntu/acpi-abat.yaml +++ b/ubuntu/acpi-abat.yaml @@ -1,7 +1,7 @@ metadata: name: abat format: "Lava-Test-Shell Test Definition 1.0" - description: "Test Automated Basic Acceptance Tests (ABAT)- V2.0 on ubuntu." + description: "Test Automated Basic Acceptance Tests (ABAT)" install: steps: diff --git a/ubuntu/acpica.yaml b/ubuntu/acpica.yaml index 469fac9..9ae8ea1 100644 --- a/ubuntu/acpica.yaml +++ b/ubuntu/acpica.yaml @@ -1,7 +1,7 @@ metadata: name: acpica format: "Lava-Test-Shell Test Definition 1.0" - description: "Test acpica on ubuntu." + description: "Test ACPICA" install: git-repos: diff --git a/ubuntu/bluetooth-enablement.yaml b/ubuntu/bluetooth-enablement.yaml index b8f13c4..72fccb6 100644 --- a/ubuntu/bluetooth-enablement.yaml +++ b/ubuntu/bluetooth-enablement.yaml @@ -1,17 +1,19 @@ metadata: name: bluetooth-enablement format: "Lava-Test-Shell Test Definition 1.0" - description: "Test bluetooth enablement in ubuntu." + description: "Test bluetooth enablement" + os: + - ubuntu install: - bzr-repos: - - lp:~linaro-foundations/linaro-ubuntu/lava-test-bt-enablement deps: - bluez + git-repos: + - http://git.linaro.org/git-ro/qa/test-definitions.git run: steps: - - "cd lava-test-bt-enablement; sudo bash -x ./run-test.sh" + - "cd ubuntu/scripts; sudo bash -x ./bluetooth-enablement-test.sh" parse: pattern: "(?P[a-zA-Z0-9_-]+):\\s(?P\\w+)" diff --git a/ubuntu/bootchart-install.yaml b/ubuntu/bootchart-install.yaml index fb5ad11..0792545 100644 --- a/ubuntu/bootchart-install.yaml +++ b/ubuntu/bootchart-install.yaml @@ -1,7 +1,7 @@ metadata: name: bootchart-install format: "Lava-Test-Shell Test Definition 1.0" - description: "Test if bootchart is installed. This is first step to run bootchart.yaml test which measures the boot time" + description: "Test if bootchart is installed (first step to run bootchart.yaml test which measures the boot time)" maintainer: - Fathi Boudra - Milosz Wasilewski diff --git a/ubuntu/bootchart.yaml b/ubuntu/bootchart.yaml index e42a4a8..08358a3 100644 --- a/ubuntu/bootchart.yaml +++ b/ubuntu/bootchart.yaml @@ -1,7 +1,7 @@ metadata: name: bootchart format: "Lava-Test-Shell Test Definition 1.0" - description: "Test case that measures the boot time." + description: "Test case that measures the boot time" maintainer: - Fathi Boudra - Milosz Wasilewski diff --git a/ubuntu/device-tree.yaml b/ubuntu/device-tree.yaml index 58e376f..5de146f 100644 --- a/ubuntu/device-tree.yaml +++ b/ubuntu/device-tree.yaml @@ -1,7 +1,7 @@ metadata: name: device-tree format: "Lava-Test-Shell Test Definition 1.0" - description: "Device tree test to check the folder structure." + description: "Device tree test to check the folder structure" os: - ubuntu devices: @@ -14,12 +14,12 @@ metadata: - lava-test-shell install: - bzr-repos: - - lp:~linaro-foundations/linaro-ubuntu/lava-test-device-tree + git-repos: + - http://git.linaro.org/git-ro/qa/test-definitions.git run: steps: - - "cd lava-test-device-tree; sudo bash -x ./run-test.sh" + - "cd ubuntu/scripts; sudo bash -x ./device-tree.sh" parse: pattern: "(?P[a-zA-Z0-9_-]+):\\s(?P\\w+)" diff --git a/ubuntu/e2eaudiotest.yaml b/ubuntu/e2eaudiotest.yaml index bfd2620..56b9fd2 100644 --- a/ubuntu/e2eaudiotest.yaml +++ b/ubuntu/e2eaudiotest.yaml @@ -1,7 +1,7 @@ metadata: name: e2eaudiotest format: "Lava-Test-Shell Test Definition 1.0" - description: "Test e2 audio in ubuntu." + description: "Test e2 audio" install: deps: diff --git a/ubuntu/fwts.yaml b/ubuntu/fwts.yaml index 636a144..0c3f19a 100644 --- a/ubuntu/fwts.yaml +++ b/ubuntu/fwts.yaml @@ -1,7 +1,7 @@ metadata: name: fwts format: "Lava-Test-Shell Test Definition 1.0" - description: "Firmware Test Suite (fwts) on ubuntu." + description: "Run Firmware Test Suite (fwts)" install: deps: diff --git a/ubuntu/gatortests.yaml b/ubuntu/gatortests.yaml index abd432e..a13999d 100644 --- a/ubuntu/gatortests.yaml +++ b/ubuntu/gatortests.yaml @@ -1,7 +1,7 @@ metadata: name: gatortests format: "Lava-Test-Shell Test Definition 1.0" - description: "Gator tests for ubuntu." + description: "Run GATOR tests" install: deps: diff --git a/ubuntu/kvm.yaml b/ubuntu/kvm.yaml index e11383b..bea14d8 100644 --- a/ubuntu/kvm.yaml +++ b/ubuntu/kvm.yaml @@ -1,7 +1,7 @@ metadata: name: kvm format: "Lava-Test-Shell Test Definition 1.0" - description: "Test kvm on ubuntu." + description: "Test KVM" install: deps: diff --git a/ubuntu/latency-test.yaml b/ubuntu/latency-test.yaml index 654c366..b01fa04 100644 --- a/ubuntu/latency-test.yaml +++ b/ubuntu/latency-test.yaml @@ -2,7 +2,7 @@ metadata: name: latency-test version: "1.0" format: "Lava-Test-Shell Test Definition 1.0" - description: "Run latency test on Ubuntu." + description: "Run latency test" os: - ubuntu devices: diff --git a/ubuntu/leb-basic-graphics.yaml b/ubuntu/leb-basic-graphics.yaml index f55247b..699ad00 100644 --- a/ubuntu/leb-basic-graphics.yaml +++ b/ubuntu/leb-basic-graphics.yaml @@ -1,7 +1,7 @@ metadata: name: leb-basic-graphics format: "Lava-Test-Shell Test Definition 1.0" - description: "Test leb basic graphics in ubuntu." + description: "Test Linaro engineering builds basic graphics" install: bzr-repos: diff --git a/ubuntu/libhugetlbfs.yaml b/ubuntu/libhugetlbfs.yaml index 8f1fd73..03ea960 100644 --- a/ubuntu/libhugetlbfs.yaml +++ b/ubuntu/libhugetlbfs.yaml @@ -1,7 +1,7 @@ metadata: name: libhugetlbfs format: "Lava-Test-Shell Test Definition 1.0" - description: "Run through libhugetlbfs next branch tests." + description: "Run through libhugetlbfs next branch tests" install: git-repos: diff --git a/ubuntu/ltp-network.yaml b/ubuntu/ltp-network.yaml index bdfbcf3..cd108d1 100644 --- a/ubuntu/ltp-network.yaml +++ b/ubuntu/ltp-network.yaml @@ -1,7 +1,7 @@ metadata: name: ltp format: "Lava-Test-Shell Test Definition 1.0" - description: "Run LTP networktests on Ubuntu." + description: "Run LTP network tests" install: steps: diff --git a/ubuntu/ltp-realtime.yaml b/ubuntu/ltp-realtime.yaml index 652da3e..50f56a2 100644 --- a/ubuntu/ltp-realtime.yaml +++ b/ubuntu/ltp-realtime.yaml @@ -1,7 +1,7 @@ metadata: name: rt-ltp format: "Lava-Test-Shell Test Definition 1.0" - description: "Run LTP test_realtime on Ubuntu." + description: "Run LTP realtime tests" install: steps: diff --git a/ubuntu/ltp.yaml b/ubuntu/ltp.yaml index 2523b74..73ec80c 100644 --- a/ubuntu/ltp.yaml +++ b/ubuntu/ltp.yaml @@ -1,7 +1,7 @@ metadata: name: ltp format: "Lava-Test-Shell Test Definition 1.0" - description: "Run LTP syscalls on Ubuntu." + description: "Run LTP syscalls tests" install: steps: diff --git a/ubuntu/network-tests-basic.yaml b/ubuntu/network-tests-basic.yaml index 07e05b4..845324d 100644 --- a/ubuntu/network-tests-basic.yaml +++ b/ubuntu/network-tests-basic.yaml @@ -1,7 +1,7 @@ metadata: format: Lava-Test Test Definition 1.0 name: network-tests-basic - description: "Basic Network Test Command for Linux Linaro ubuntu Images" + description: "Basic network test commands for Linaro Ubuntu images" run: steps: diff --git a/ubuntu/perf.yaml b/ubuntu/perf.yaml index 78e52cc..6eac241 100644 --- a/ubuntu/perf.yaml +++ b/ubuntu/perf.yaml @@ -1,18 +1,27 @@ metadata: name: perf format: "Lava-Test-Shell Test Definition 1.0" - description: "Performance tests in ubuntu." + description: "Run performance tests (perf)" + os: + - ubuntu + devices: + - origen + - snowball + - panda + - panda-es + - vexpress + - highbank install: - bzr-repos: - - lp:~linaro-maintainers/lava-test/lava-test-perf + git-repos: + - http://git.linaro.org/git-ro/qa/test-definitions.git deps: - linux-tools - stress-dbgsym run: steps: - - cd lava-test-perf + - cd ubuntu/scripts - sudo bash -x ./run-perf-test.sh parse: diff --git a/ubuntu/pwrmgmt.yaml b/ubuntu/pwrmgmt.yaml index 8b4970d..0e36b79 100644 --- a/ubuntu/pwrmgmt.yaml +++ b/ubuntu/pwrmgmt.yaml @@ -1,7 +1,7 @@ metadata: name: pwrmgmt format: "Lava-Test-Shell Test Definition 1.0" - description: "Test power management in ubuntu." + description: "Test power management (PM-QA)" install: deps: diff --git a/ubuntu/rt-hackbench.yaml b/ubuntu/rt-hackbench.yaml index 7b04dd4..d733492 100644 --- a/ubuntu/rt-hackbench.yaml +++ b/ubuntu/rt-hackbench.yaml @@ -1,7 +1,7 @@ metadata: name: rt-hackbench format: "Lava-Test-Shell Test Definition 1.0" - description: "Hackbench Real Time Suite" + description: "Run Hackbench Real Time Suite" install: git-repos: diff --git a/ubuntu/rt-ltp.yaml b/ubuntu/rt-ltp.yaml index a94f110..815db49 100644 --- a/ubuntu/rt-ltp.yaml +++ b/ubuntu/rt-ltp.yaml @@ -1,7 +1,7 @@ metadata: name: rt-ltp format: "Lava-Test-Shell Test Definition 1.0" - description: "Realtime LTP tests." + description: "Run LTP realtime tests" install: steps: diff --git a/ubuntu/scripts/basic-graphics-test.sh b/ubuntu/scripts/basic-graphics-test.sh new file mode 100755 index 0000000..ec828c7 --- /dev/null +++ b/ubuntu/scripts/basic-graphics-test.sh @@ -0,0 +1,170 @@ +#!/bin/bash +# +# Basic Graphics test cases +# +# Copyright (C) 2012, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Ricardo Salveti +# + +DEFAULT_USER="linaro" + +source include/sh-test-lib + +set_lightdm_session() { + session=$1 + + # make sure no other config file is bypassing us + rm -f /home/$DEFAULT_USER/.dmrc + rm -rf /var/cache/lightdm + rm -rf /var/lib/AccountsService/users + dbus_user_path=`dbus-send --system --type=method_call --print-reply \ + --dest=org.freedesktop.Accounts /org/freedesktop/Accounts \ + org.freedesktop.Accounts.FindUserByName string:$DEFAULT_USER \ + | awk -F "\"" {'print $2'}` + dbus-send --system --type=method_call --print-reply \ + --dest=org.freedesktop.Accounts ${dbus_user_path} \ + org.freedesktop.Accounts.User.SetXSession string:$session 1>&2 +} + +kill_xorg() { + pid=`pidof /usr/bin/X` + if [ "x$pid" != "x" ]; then + kill -9 $pid 1>&2 + fi + rm -f /tmp/.X0-lock +} + +test_restore() { + kill_xorg + service lightdm stop 1>&2 + sleep 2 + service lightdm start 1>&2 + sleep 10 # give enough time to start +} + +## Test case definitions + +# Validate that Xorg is running +test_xorg() { + TEST="xorg_running" + if ! service lightdm status | grep -q "start\/running"; then + service lightdm start 1>&2 + check_return_fail "lightdm start" && return 1 + sleep 10 # give enough time to start and possibly fail + fi + + pidof "/usr/bin/X" 1>&2 + check_return_fail "Xorg not running" && return 1 + + pass_test +} + +# Validate that the board can run unity-2d +test_unity2d() { + TEST="unity_2d_running" + + service lightdm stop 1>&2 + sleep 2 # to die in peace + set_lightdm_session ubuntu-2d + service lightdm start 1>&2 + check_return_fail "lightdm start" && return 1 + + sleep 120 + pidof "/usr/bin/unity-2d-panel" 1>&2 + check_return_fail "unity-2d-panel not running" && return 1 + pidof "/usr/bin/unity-2d-shell" 1>&2 + check_return_fail "unity-2d-shell not running" && return 1 + + pass_test +} + +# Validate that the board can run unity-3d +test_unity3d() { + TEST="unity_3d_running" + + service lightdm stop 1>&2 + sleep 2 # to die in peace + set_lightdm_session ubuntu + service lightdm start 1>&2 + check_return_fail "lightdm start" && return 1 + + sleep 180 + pidof "/usr/bin/compiz" 1>&2 + check_return_fail "compiz not running" && return 1 + pidof "/usr/bin/gtk-window-decorator" 1>&2 + check_return_fail "gtk-window-decorator not running" && return 1 + pidof "/usr/lib/unity/unity-panel-service" 1>&2 + check_return_fail "unity-panel-service not running" && return 1 + + pass_test +} + +# Validate that the board is able to start unity 3d +test_unity_support() { + TEST="nux_tools_unity_support" + + service lightdm stop 1>&2 + kill_xorg + sleep 2 # to die in peace + (/usr/bin/X -verbose 10 :0 1>&2 &) + export DISPLAY=:0.0 + check_return_fail "Xorg failed to start" && return 1 + + sleep 5 + /usr/lib/nux/unity_support_test 1>&2 + check_return_fail "unity 3d is not supported" && return 1 + + pass_test +} + +# Validate that the board has a valid gles driver +test_opengles_driver() { + TEST="valid_not_mesa_opengles_driver" + + service lightdm stop 1>&2 + kill_xorg + sleep 2 # to die in peace + (/usr/bin/X -verbose 10 :0 1>&2 &) + export DISPLAY=:0.0 + check_return_fail "Xorg failed to start" && return 1 + sleep 5 + + /usr/bin/es2_info 1>&2 + + if /usr/bin/es2_info 2>&1 | grep -q "EGL_VENDOR = Mesa"; then + fail_test "EGL driver provided by Mesa" + return 1 + fi + + pass_test +} + +# check we're root +if ! check_root; then + error_msg "Please run the test case as root" +fi + +# run the tests +test_xorg +test_unity2d +test_unity3d +test_unity_support +test_opengles_driver + +# get lightdm running again for later usage +test_restore diff --git a/ubuntu/scripts/bluetooth-enablement-test.sh b/ubuntu/scripts/bluetooth-enablement-test.sh new file mode 100755 index 0000000..4794c16 --- /dev/null +++ b/ubuntu/scripts/bluetooth-enablement-test.sh @@ -0,0 +1,199 @@ +#!/bin/bash +# +# Bluetooth Enablement test cases +# +# Copyright (C) 2012, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Ricardo Salveti +# +# TODO: Add support for pairing + +SERV_BD_ID="LAVA-Bluetooth01" +SERV_BD_ADDR="00:15:83:15:A3:10" +IFACE="" +IFACE_ADDR="" + +source include/sh-test-lib + +## Test case definitions + +# Has bt adapter +test_has_valid_bt_adapter() { + TEST="has_valid_bt_adapter" + + # show interfaces at stderr, so it can be useful at lava's dashboard + hciconfig 1>&2 + + # for now grab just the first device + TESTIFACE=`hciconfig | head -n 1 | cut -d':' -f1` + [ "x$TESTIFACE" == "x" ] && fail_test "No bluetooth adapter found" && return 1 + + # check if it can put the interface up + hciconfig $TESTIFACE up + check_return_fail "Unable to open and initialize HCI device ($TESTIFACE)" && return 1 + + # set piscan at the bt interface + hciconfig $TESTIFACE piscan + check_return_fail "Unable to enable page and inquire scan ($TESTIFACE)" && return 1 + + # make sure the bt interface has a valid bd address + TESTIFACE_ADDR=`hciconfig $TESTIFACE | grep "BD Address" | awk '{print $3}'` + [ "x$TESTIFACE_ADDR" == "x00:00:00:00:00:00" ] && fail_test "Adapter's mac addr is null" && return 1 + + # set IFACE as a valid bt interface + IFACE=$TESTIFACE + IFACE_ADDR=$TESTIFACE_ADDR + + pass_test +} + +test_bluez_adapter_get_address() { + TEST="bluez_adapter_get_address" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + addr=`bluez-test-adapter address` + [ "x$addr" == "x" ] && fail_test "Bluez: failed to get adapter's address" && return 1 + [ "$addr" != "$IFACE_ADDR" ] && fail_test "Bluez: adapter addr != hciconfig addr" && return 1 + + pass_test +} + +test_bluez_adapter_set_name() { + TEST="bluez_adapter_set_name" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + # get original name + orig_name=`bluez-test-adapter name` + [ "x$orig_name" == "x" ] && fail_test "Bluez: failed to get adapter's orignal name" && return 1 + + # set to custom name + bluez-test-adapter name linaro-bt-test + check_return_fail "Bluez: unable to set device's name" && return 1 + + # get custom name + custom_name=`bluez-test-adapter name` + [ "x$custom_name" == "x" ] && fail_test "Bluez: failed to get adapter's custom name" && return 1 + [ "$custom_name" != "linaro-bt-test" ] && fail_test "Bluez: adap name != custom one" && return 1 + + # set back to original + bluez-test-adapter name $orig_name + check_return_fail "Bluez: unable to set device original name" && return 1 + + pass_test +} + +test_bluez_adapter_powered_on_off() { + TEST="bluez_adapter_powered_on_off" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + # assume powered by default + for i in 1 2 3; do + bluez-test-adapter powered off + check_return_fail "Bluez: failed to set powered off" && return 1 + sleep 2 + bluez-test-adapter powered on + check_return_fail "Bluez: failed to set powered on" && return 1 + sleep 2 + done + + pass_test +} + +test_bluez_adapter_pairable_on_off() { + TEST="bluez_adapter_pairable_on_off" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + # assume pairable on by default + for i in 1 2 3; do + bluez-test-adapter pairable off + check_return_fail "Bluez: failed to set pairable off" && return 1 + sleep 2 + bluez-test-adapter pairable on + check_return_fail "Bluez: failed to set pairable on" && return 1 + sleep 2 + done + + pass_test +} + +test_bluez_adapter_discoverable_on_off() { + TEST="bluez_adapter_discoverable_on_off" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + # assume discoverable on by default + for i in 1 2 3; do + bluez-test-adapter discoverable off + check_return_fail "Bluez: failed to set discoverable off" && return 1 + sleep 5 + bluez-test-adapter discoverable on + check_return_fail "Bluez: failed to set discoverable on" && return 1 + sleep 5 + done + + pass_test +} + +test_bluez_hci_discovery() { + TEST="bluez_hci_discovery" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + bluez-test-discovery 1>&2 + check_return_fail "Bluez: failed to scan for bt devices" && return 1 + hcitool -i $IFACE scan 1>&2 + check_return_fail "Hcitool: failed to scan for bt devices" && return 1 + + pass_test +} + +test_bluez_discovery_find_target_ap() { + TEST="bluez_discovery_find_target_ap" + [ "x$IFACE" == "x" ] && fail_test "No valid bluetooth adapter found" && return 1 + + scan_out=`bluez-test-discovery` + if ! echo $scan_out | grep -q "Name = $SERV_BD_ID"; then + fail_test "Bluez: failed to find target AP ($SERV_BD_ID) when scanning" + return 1 + fi + if ! echo $scan_out | grep -q "[ $SERV_BD_ADDR ]"; then + fail_test "Bluez: failed to find target AP addr ($SERV_BD_ADDR) when scanning" + return 1 + fi + + pass_test +} + +# check we're root +if ! check_root; then + error_msg "Please run the test case as root" +fi + +# test to check if we have an bt adapter +test_has_valid_bt_adapter + +# run the tests + +## using bluez-tests +test_bluez_adapter_get_address +test_bluez_adapter_set_name +test_bluez_adapter_powered_on_off +test_bluez_adapter_pairable_on_off +test_bluez_adapter_discoverable_on_off +test_bluez_hci_discovery +test_bluez_discovery_find_target_ap + +# exit with a good return code, so lava believes it finished OK +exit 0 diff --git a/ubuntu/scripts/device-tree.sh b/ubuntu/scripts/device-tree.sh new file mode 100755 index 0000000..f22ee5a --- /dev/null +++ b/ubuntu/scripts/device-tree.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# Device Tree Enablement test cases +# +# Copyright (C) 2012, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Ricardo Salveti +# + +source include/sh-test-lib + +## Test case definitions + +# Check if /proc/device-tree is available +test_has_proc_device_tree() { + TEST="has_proc_device_tree" + + if [ ! -d /proc/device-tree ]; then + fail_test "Unable to find /proc/device-tree" + return 1 + fi + + find /proc/device-tree + + pass_test +} + +# Check if model is not empty +test_device_tree_model_not_empty() { + TEST="device_tree_model_not_empty" + + if [ ! -f /proc/device-tree/model ]; then + fail_test "Unable to find /proc/device-tree/model" + return 1 + fi + + model=`cat /proc/device-tree/model` + if [ -z "$model" ]; then + fail_test "Empty model description at /proc/device-tree/model" + return 1 + fi + + echo "MODEL: $model" 1>&2 + + pass_test +} + +# check we're root +if ! check_root; then + error_msg "Please run the test case as root" +fi + +# run the tests +test_has_proc_device_tree +test_device_tree_model_not_empty + +# clean exit so lava-test can trust the results +exit 0 diff --git a/ubuntu/scripts/include/sh-test-lib b/ubuntu/scripts/include/sh-test-lib new file mode 100644 index 0000000..6c0e8f2 --- /dev/null +++ b/ubuntu/scripts/include/sh-test-lib @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Shared shell library for test management +# +# Copyright (C) 2012, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Ricardo Salveti +# + +function error_msg() { + local msg=$1 + test -z "$msg" && msg="Unknown error" + echo "ERROR: $msg" >&2 + exit 1 +} + +function warn_msg() { + local msg=$1 + test -z "$msg" && msg="Unknown error" + echo "WARNING: $msg\n" >&2 +} + +function check_return_fail() { + if [ $? -ne 0 ]; then + fail_test "$1" + return 0 + else + return 1 + fi +} + +function fail_test() { + local reason=$1 + echo "${TEST}: FAIL - ${reason}" +} + +function pass_test() { + echo "${TEST}: PASS" +} + +function check_root() { + if [ $UID -eq 0 ]; then + return 0 + else + return 1 + fi +} + diff --git a/ubuntu/scripts/run-perf-test.sh b/ubuntu/scripts/run-perf-test.sh new file mode 100755 index 0000000..912dd73 --- /dev/null +++ b/ubuntu/scripts/run-perf-test.sh @@ -0,0 +1,84 @@ +#!/bin/sh +# Copyright (C) 2012, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Avik Sil +# + +set -x + +# Test user id +if [ `whoami` != 'root' ] ; then + echo "You must be the superuser to run this script" >&2 + exit 1 +fi + +# Let's assume that only Ubuntu has apt-get... +if [ -e /usr/bin/apt-get ]; then + # Install most appropriate linux-linaro-tools-* package + KERNELVER=`uname -r | cut -f 1 -d'-'` + PKGNAME=`apt-cache search "linux-linaro-tools-$KERNELVER" | head -1 | cut -f 1 -d' '` + PERFBIN_PREFIX="/usr/bin/perf_" + PERFBIN_VER=`uname -r | awk -F '-' '{print $1"-"$2}'` + if [ ! -e $PERFBIN_PREFIX$PERFBIN_VER ]; then + apt-get install --yes $PKGNAME + PERFBIN=`dpkg -L $PKGNAME | grep perf_` + if [ "$PERFBIN" != "$PERFBIN_PREFIX$PERFBIN_VER" ]; then + ln -s $PERFBIN $PERFBIN_PREFIX$PERFBIN_VER + fi + fi +fi + +# Test 'perf record' +echo "Performing perf record test..." +TCID="perf record test" +perf record -e cycles -o perf-lava-test.data stress -c 4 -t 10 2>&1 | tee perf-record.log +samples=`grep -ao "[0-9]\+[ ]\+samples" perf-record.log| cut -f 1 -d' '` +if [ $samples -gt 1 ]; then + echo "$TCID : PASS" +else + echo "$TCID : FAIL" +fi +rm perf-record.log + +# Test 'perf report' +echo "Performing perf report test..." +TCID="perf report test" +perf report -i perf-lava-test.data 2>&1 | tee perf-report.log +pcnt_samples=`grep -c -e "^[ ]\+[0-9]\+.[0-9]\+%" perf-report.log` +if [ $pcnt_samples -gt 1 ]; then + echo "$TCID : PASS" +else + echo "$TCID : FAIL" +fi +rm perf-report.log perf-lava-test.data + +# Test 'perf stat' +echo "Performing perf stat test..." +TCID="perf stat test" +perf stat -e cycles stress -c 4 -t 10 2>&1 | tee perf-stat.log +cycles=`grep -o "[0-9,]\+[ ]\+cycles" perf-stat.log | sed 's/,//g' | cut -f 1 -d' '` +if [ $cycles -gt 1 ]; then + echo "$TCID : PASS" +else + echo "$TCID : FAIL" +fi +rm perf-stat.log + +# Test 'perf test' +echo "Performing 'perf test'..." +TCID="perf test" +perf test 2>&1 | sed -e 's/FAILED!/FAIL/g' -e 's/Ok/PASS/g' -e "s/[ ]\?[0-9]\+:/$TCID -/g" -e 's/:/ :/g' diff --git a/ubuntu/scripts/wifi-enablement-test.sh b/ubuntu/scripts/wifi-enablement-test.sh new file mode 100755 index 0000000..3c964b1 --- /dev/null +++ b/ubuntu/scripts/wifi-enablement-test.sh @@ -0,0 +1,289 @@ +#!/bin/bash +# +# Wifi Enablement test cases +# +# Copyright (C) 2012, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Ricardo Salveti +# Alexander Sack +# +# TODO: Improve argument parsing + +# arguments: SSID, PSK, WPA DRIVER +SSID="$1" +PSK="$2" +DRIVER="$3" +IFACE="" +GCTRLIFACE="/var/run/wpasupplicant-global-lava-test" +LCTRLIFACE="/var/run/wpasupplicant-local-lava-test" +PFDHCLIENT="/var/run/dhclient-lava-test.pid" +SAMPLEFILE="http://readyshare.routerlogin.net/shares/USB_Storage/samplemedia.linaro.org/mpeg4/big_buck_bunny_1080p_MPEG4_MP3_25fps_7600K.AVI" + +source include/sh-test-lib + +test_setup() { + service network-manager stop 1>&2 + killall -9 wpa_supplicant 1>&2 + killall -9 dhclient 1>&2 + [ "x$IFACE" != "x" ] && ifconfig $IFACE 0.0.0.0 + rm -f $GCTRLIFACE + rm -f $LCTRLIFACE + rm -f $PFDHCLIENT +} + +test_restore() { + killall -9 wpa_supplicant 1>&2 + killall -9 dhclient 1>&2 + [ "x$IFACE" != "x" ] && ifconfig $IFACE 0.0.0.0 + rm -f $GCTRLIFACE + rm -f $LCTRLIFACE + rm -f $PFDHCLIENT + service network-manager start 1>&2 +} + +## Test case definitions + +# Has wireless device +test_has_wireless_device() { + TEST="has_wireless_device_${SSID}_${DRIVER}" + + iwconfig 1>&2 + + # for now grab just the first interface + IFACE=`iwconfig | grep '^[a-zA-Z]*[0-9]*.*IEEE.*ESS.*$' \ + | head -n1 | sed -e 's/[ ].*$//'` + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + pass_test +} + +# Able to put interface down +test_able_put_iface_down() { + TEST="able_put_iface_down_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + ifconfig $IFACE down + check_return_fail "unable to put interface $IFACE down" && return 1 + + pass_test +} + +# Able to put interface up +test_able_put_iface_up() { + TEST="able_put_iface_up_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + ifconfig $IFACE up + check_return_fail "unable to put interface $IFACE up" && return 1 + + pass_test +} + +# Can scan for APs +test_able_scan_aps() { + TEST="able_scan_aps_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + # should work for at least 3 times in a row + for i in 1 2 3; do + iwlist $IFACE scan 1>&2 + check_return_fail "failed to scan for aps" && return 1 + sleep 3 + done + + pass_test +} + +# Can find target AP +test_able_scan_find_target_ap() { + TEST="able_scan_find_target_ap_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + iwlist $IFACE scan | grep -q "ESSID:\"$SSID\"" + check_return_fail "unable to find ESSID '$SSID' while scanning for APs" && return 1 + + pass_test +} + +# Can start wpa supplicant +test_able_start_wpa_supplicant() { + TEST="able_start_wpa_supplicant_${SSID}_${DRIVER}" + + /sbin/wpa_supplicant -dd -B -g $GCTRLIFACE 1>&2 + check_return_fail "fail to start wpa_supplicant" && return 1 + + if [ ! -S $GCTRLIFACE ]; then + fail_test "fail to create wpa supplicant global ctrl_interface" + return 1 + fi + + pass_test +} + +# Can add interface wpa supplicant +test_able_add_iface_wpa_supplicant() { + TEST="able_add_iface_wpa_supplicant_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + ret=$(/sbin/wpa_cli -g $GCTRLIFACE interface_add $IFACE "" $DRIVER $LCTRLIFACE) + if ! echo ${ret} | egrep -q "OK$"; then + fail_test "fail to add interface $IFACE with wpa_cli" + return 1 + fi + + pass_test +} + +# Can add network wpa supplicant +test_able_add_network_wpa_supplicant() { + TEST="able_add_network_wpa_supplicant_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + /sbin/wpa_cli -p $LCTRLIFACE -i$IFACE add_network 1>&2 + check_return_fail "fail to add network with wpa_cli" && return 1 + + pass_test +} + +# Can config network wpa supplicant +test_able_set_network_wpa_supplicant() { + TEST="able_set_network_wpa_supplicant_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + ret=$(/sbin/wpa_cli -p $LCTRLIFACE -i$IFACE set_network 0 ssid \""$SSID"\") + if [ "x$ret" != "xOK" ]; then + fail_test "fail to set the network SSID '$SSID' with wpa_cli" + return 1 + fi + ret=$(/sbin/wpa_cli -p $LCTRLIFACE -i$IFACE set_network 0 psk \""$PSK"\") + if [ "x$ret" != "xOK" ]; then + fail_test "fail to set the network PSK '$SSID' with wpa_cli" + return 1 + fi + + pass_test +} + +# Can enable network wpa supplicant +test_able_enable_network_wpa_supplicant() { + TEST="able_enable_network_wpa_supplicant_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + ret=$(/sbin/wpa_cli -p $LCTRLIFACE -i$IFACE enable_network 0) + if [ "x$ret" != "xOK" ]; then + fail_test "fail to enable the network with wpa_cli" + return 1 + fi + + pass_test +} + +# Can associate at the AP +test_able_associate_ap_wpa_supplicant() { + TEST="able_associate_ap_wpa_supplicant_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + i=1 + ret=FAIL + while [ $i -le 20 ]; do + sleep 1 + if /sbin/wpa_cli -p $LCTRLIFACE -i$IFACE status \ + | grep -q "wpa_state=COMPLETED"; then + ret=OK + break + fi + i=$((i+1)) + done + + if [ "x$ret" != "xOK" ]; then + fail_test "fail to associate to AP" + return 1 + fi + + pass_test +} + +# Can grap ip with dhclient +test_able_get_ip_dhclient() { + TEST="able_get_ip_dhclient_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + /sbin/dhclient -pf $PFDHCLIENT $IFACE 1>&2 + /sbin/ifconfig -a 1>&2 + + if [ ! -f $PFDHCLIENT ]; then + fail_test "fail get a valid ip address from AP" + return 1 + fi + + pass_test +} + +# Can transfer a file and use the network +test_able_transfer_file_network() { + TEST="able_transfer_file_${SSID}_${DRIVER}" + [ "x$IFACE" == "x" ] && fail_test "No valid wireless interface found" && return 1 + + /usr/bin/wget --tries=3 --output-document=/tmp/samplefile ${SAMPLEFILE} 1>&2 + check_return_fail "fail to download $SAMPLEFILE" && return 1 + + pass_test +} + +# Can terminate wpa supplicant ip with dhclient +test_able_terminate_wpa_supplicant() { + TEST="able_terminate_wpa_supplicant_${SSID}_${DRIVER}" + + # take a nap before closing wpa supplicant down + sleep 5 + ret=$(/sbin/wpa_cli -g $GCTRLIFACE terminate) + if ! echo ${ret} | egrep -q "OK$"; then + fail_test "fail to terminate wpa supplicant" + return 1 + fi + + pass_test +} + +# check we're root +if ! check_root; then + error_msg "Please run the test case as root" +fi + +# test to check if we have an interface +test_has_wireless_device + +# setup the environment +test_setup + +# run the tests +test_able_put_iface_down +test_able_put_iface_up +test_able_scan_aps +test_able_scan_find_target_ap +test_able_start_wpa_supplicant +test_able_add_iface_wpa_supplicant +test_able_add_network_wpa_supplicant +test_able_set_network_wpa_supplicant +test_able_enable_network_wpa_supplicant +test_able_associate_ap_wpa_supplicant +test_able_get_ip_dhclient +test_able_transfer_file_network +test_able_terminate_wpa_supplicant + +# get back the environment to previous state +test_restore diff --git a/ubuntu/smoke-tests-basic.yaml b/ubuntu/smoke-tests-basic.yaml index 5cb11a3..999fdb8 100644 --- a/ubuntu/smoke-tests-basic.yaml +++ b/ubuntu/smoke-tests-basic.yaml @@ -1,7 +1,7 @@ metadata: format: Lava-Test Test Definition 1.0 name: smoke-tests-basic - description: "Basic system test command for Linux Linaro ubuntu Images" + description: "Basic system test command for Linaro Ubuntu images" run: steps: diff --git a/ubuntu/wifi-enablement.yaml b/ubuntu/wifi-enablement.yaml index e4af65f..207b89d 100644 --- a/ubuntu/wifi-enablement.yaml +++ b/ubuntu/wifi-enablement.yaml @@ -1,11 +1,13 @@ metadata: name: wifi-enablement format: "Lava-Test-Shell Test Definition 1.0" - description: "Test wifi enablement in ubuntu." + description: "Test wifi enablement" + os: + - ubuntu install: - bzr-repos: - - lp:~linaro-foundations/linaro-ubuntu/lava-test-wifi-enablement + git-repos: + - http://git.linaro.org/git-ro/qa/test-definitions.git deps: - wpasupplicant - isc-dhcp-client @@ -14,7 +16,10 @@ install: run: steps: - - "cd lava-test-wifi-enablement; sudo bash -x ./run-test.sh" + - "cd ubuntu/scripts" + - "sudo bash -x ./wifi-enablement-test.sh LAVA-WiFiTest01 LemonFileDentist nl80211" + - "sudo bash -x ./wifi-enablement-test.sh LAVA-WiFiTest01 LemonFileDentist wext" + parse: pattern: "(?P[a-zA-Z0-9_-]+):\\s(?P\\w+)" -- cgit v1.2.3