From patchwork Mon Dec 5 22:54:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Van Hoof X-Patchwork-Id: 129460 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 167BC1007D4 for ; Tue, 6 Dec 2011 09:55:17 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RXhRL-0001Zb-U8 for incoming@patchwork.ozlabs.org; Mon, 05 Dec 2011 22:55:15 +0000 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RXhRJ-0001Yo-BS for fwts-devel@lists.ubuntu.com; Mon, 05 Dec 2011 22:55:13 +0000 X-Authority-Analysis: v=2.0 cv=BK0xXSsG c=1 sm=0 a=jrUOvm/RFT1SBfzjC7VLzg==:17 a=cSLP9zYandcA:10 a=1XB9yynOT10A:10 a=COoIie5QieiCWsr6wvAA:9 a=62l1QxhjvXFJSWAjKmQA:7 a=nkxwrLemh8NpsZLW:21 a=V6TJ2z_WmdFUFPd8:21 a=jrUOvm/RFT1SBfzjC7VLzg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 174.109.107.185 Received: from [174.109.107.185] ([174.109.107.185:62761] helo=haddonfield.itb.ouwish.com) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 6B/97-08851-FCB4DDE4; Mon, 05 Dec 2011 22:55:11 +0000 Received: from haddonfield.itb.ouwish.com (localhost [127.0.0.1]) by haddonfield.itb.ouwish.com (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id pB5MsxFI025450 for ; Mon, 5 Dec 2011 17:54:59 -0500 Received: (from vanhoof@localhost) by haddonfield.itb.ouwish.com (8.14.4/8.14.4/Submit) id pB5MsxBZ025449 for fwts-devel@lists.ubuntu.com; Mon, 5 Dec 2011 17:54:59 -0500 From: Chris Van Hoof To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/5] Renaming directory 'iso-image' to 'live-image' and 'live-image/fwts_wrapper' to 'live-image/fwts-frontend-text' Date: Mon, 5 Dec 2011 17:54:55 -0500 Message-Id: <1323125699-25351-2-git-send-email-vanhoof@canonical.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1323125699-25351-1-git-send-email-vanhoof@canonical.com> References: <1323125699-25351-1-git-send-email-vanhoof@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com --- iso-image/fwts_wrapper | 232 ----------------------------------------- live-image/fwts-frontend-text | 232 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+), 232 deletions(-) delete mode 100755 iso-image/fwts_wrapper create mode 100755 live-image/fwts-frontend-text diff --git a/iso-image/fwts_wrapper b/iso-image/fwts_wrapper deleted file mode 100755 index 9b92eb8..0000000 --- a/iso-image/fwts_wrapper +++ /dev/null @@ -1,232 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2010-2011 Canonical -# -# 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. -# -FWTS="Firmware Test Suite" -OPTIONS="/tmp/options.$$" -DIALOG_CMD="/tmp/fwts.cmd.$$" - -FWTS_DATE=`date +%d%m%Y` -FWTS_TIME=`date +%H%M` - -WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME - -# -# for debugging, use: -# WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME -# -SHUTDOWN_AT_END=1 - - -do_help() -{ - dialog --backtitle "$FWTS" --title "Help" --msgbox \ - "To make selections from the menu use the following keys:\n\nUse the up/down cursor keys to navigate to the desired menu option and the bar to tick the menu selection.\n\nUse the left/right or tab keys to navigate the button options and press the key to select." 13 60 -} - -# -# Run a bunch of tests and monitor progress -# -do_test() -{ - - num_tests=`fwts $1 --show-tests | wc -l` - num_tests=$((num_tests - 1)) - if [ $num_tests -gt 0 ]; then - fwts --force-clean --skip-test=s3,s4 $1 --show-progress-dialog | dialog --backtitle "$FWTS" --title "$2" --gauge "" 13 80 0 - fi -} - -# -# Get user choice of tests to run -# -select_tests() -{ - while true - do - declare -a tests - x=0 - # - # Discover available tests - # - fwts --batch --batch-experimental --show-tests | grep "^ " > $OPTIONS - while read test text - do - ((x++)) - tests[$x]=$test - txt="${txt} ${x} \"${text}\" off" - done < $OPTIONS - rm $OPTIONS - - # - # Construct and run dialog - # - echo dialog --backtitle '"$FWTS"' --title '"Select Tests to Run"' --help-button --checklist '"Select from the list below the test(s) you want to run. Use up/down cursor keys, space to select and enter to start:"' 20 70 $x $txt > $DIALOG_CMD - . $DIALOG_CMD 2> $OPTIONS - ret=$? - rm $DIALOG_CMD - - # - # Scan return selections and build fwts test scenarios - # - x=0 - for i in `cat $OPTIONS` - do - ((x++)) - i=${i#\"} - i=${i%\"} - run_tests="$run_tests ${tests[$i]}" - done - - # - # Handle dialog exit states: - # - case $ret in - 0) - if [ $x -eq 0 ]; then - dialog --backtitle "$FWTS" --title "No Tests Selected!" --msgbox \ - " You did not select any tests to be run." 5 50 - else - fwts --force-clean $run_tests --show-progress-dialog | dialog --backtitle "$FWTS" --title "$2" --gauge "" 15 80 0 - done_tests_finish - fi - ;; - 1) - return - ;; - 2) - do_help - ;; - 255) - no_tests_finish - ;; - esac - done -} - -# -# View the results log -# -view_results() -{ - tempfile=/tmp/view_results.tmp.$$ - dialog --print-maxsize 2>| $tempfile - term_height=`sed -n "s/^MaxSize: \([0-9]*\), \([0-9]*\)$/\1/p" $tempfile 2> /dev/null` - term_width=` sed -n "s/^MaxSize: \([0-9]*\), \([0-9]*\)$/\2/p" $tempfile 2> /dev/null` - term_height=$((term_height)) - term_width=$((term_width - 2)) - rm $tempfile - - dialog --backtitle "$FWTS" --title "Test Results" \ - --textbox results.log \ - $term_height $term_width -} - -# -# Shutdown or exit -# -finish() -{ - if [ $SHUTDOWN_AT_END -eq 1 ]; then - dialog --backtitle "$FWTS" --infobox " Shutting down.." 3 30 - shutdown -P now - exit 0 - else - dialog --clear - exit 0 - fi -} - -# -# Aborted, no tests run -# -no_tests_finish() -{ - dialog --backtitle "$FWTS" --title "Abort Testing!" --msgbox \ - " You did not select any tests to be run.\n\n Press Enter to shutdown." 7 50 - finish -} - -# -# Finish after running some tests -# -done_tests_finish() -{ - dialog --backtitle "$FWTS" --title "Testing Complete" --yesno \ -"The results can be found on the USB stick in the\n -the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\n - Do you want to view the results log now?" 9 55 - case $? in - 0) - view_results - ;; - 1|255) - ;; - esac - - dialog --backtitle "$FWTS" --title "Testing Complete" --msgbox \ -"The results can be found on the USB stick in the\n -the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\n - Press Enter to shutdown" 9 55 - finish -} - -# -# Here we go.. -# -mkdir -p $WORK_DIR >& /dev/null -if [ $? -ne 0 ]; then - dialog --ok-label "Shutdown" --backtitle "$FWTS" --title "Error" --msgbox "Could not create directory fwts/$FWTS_DATE/$FWTS_TIME to store test results.\n\n Press Enter to shutdown." 8 50 - finish - exit 0 -fi - -while true -do - dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ - "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ -The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ - 18 70 4 \ - 1 "All Batch Tests" on \ - 2 "Select Individual Tests" off \ - 3 "Abort Testing" off \ - 2> $OPTIONS - - case $? in - 0) - cd $WORK_DIR >& /dev/null - case `cat $OPTIONS` in - '1') - do_test "--batch" 'Running Batch Tests' - done_tests_finish - ;; - '2') - select_tests - ;; - '3') - no_tests_finish - ;; - esac - ;; - 2) - do_help - ;; - 1|255) - no_tests_finish - ;; - esac -done diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text new file mode 100755 index 0000000..9b92eb8 --- /dev/null +++ b/live-image/fwts-frontend-text @@ -0,0 +1,232 @@ +#!/bin/bash +# +# Copyright (C) 2010-2011 Canonical +# +# 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. +# +FWTS="Firmware Test Suite" +OPTIONS="/tmp/options.$$" +DIALOG_CMD="/tmp/fwts.cmd.$$" + +FWTS_DATE=`date +%d%m%Y` +FWTS_TIME=`date +%H%M` + +WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME + +# +# for debugging, use: +# WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME +# +SHUTDOWN_AT_END=1 + + +do_help() +{ + dialog --backtitle "$FWTS" --title "Help" --msgbox \ + "To make selections from the menu use the following keys:\n\nUse the up/down cursor keys to navigate to the desired menu option and the bar to tick the menu selection.\n\nUse the left/right or tab keys to navigate the button options and press the key to select." 13 60 +} + +# +# Run a bunch of tests and monitor progress +# +do_test() +{ + + num_tests=`fwts $1 --show-tests | wc -l` + num_tests=$((num_tests - 1)) + if [ $num_tests -gt 0 ]; then + fwts --force-clean --skip-test=s3,s4 $1 --show-progress-dialog | dialog --backtitle "$FWTS" --title "$2" --gauge "" 13 80 0 + fi +} + +# +# Get user choice of tests to run +# +select_tests() +{ + while true + do + declare -a tests + x=0 + # + # Discover available tests + # + fwts --batch --batch-experimental --show-tests | grep "^ " > $OPTIONS + while read test text + do + ((x++)) + tests[$x]=$test + txt="${txt} ${x} \"${text}\" off" + done < $OPTIONS + rm $OPTIONS + + # + # Construct and run dialog + # + echo dialog --backtitle '"$FWTS"' --title '"Select Tests to Run"' --help-button --checklist '"Select from the list below the test(s) you want to run. Use up/down cursor keys, space to select and enter to start:"' 20 70 $x $txt > $DIALOG_CMD + . $DIALOG_CMD 2> $OPTIONS + ret=$? + rm $DIALOG_CMD + + # + # Scan return selections and build fwts test scenarios + # + x=0 + for i in `cat $OPTIONS` + do + ((x++)) + i=${i#\"} + i=${i%\"} + run_tests="$run_tests ${tests[$i]}" + done + + # + # Handle dialog exit states: + # + case $ret in + 0) + if [ $x -eq 0 ]; then + dialog --backtitle "$FWTS" --title "No Tests Selected!" --msgbox \ + " You did not select any tests to be run." 5 50 + else + fwts --force-clean $run_tests --show-progress-dialog | dialog --backtitle "$FWTS" --title "$2" --gauge "" 15 80 0 + done_tests_finish + fi + ;; + 1) + return + ;; + 2) + do_help + ;; + 255) + no_tests_finish + ;; + esac + done +} + +# +# View the results log +# +view_results() +{ + tempfile=/tmp/view_results.tmp.$$ + dialog --print-maxsize 2>| $tempfile + term_height=`sed -n "s/^MaxSize: \([0-9]*\), \([0-9]*\)$/\1/p" $tempfile 2> /dev/null` + term_width=` sed -n "s/^MaxSize: \([0-9]*\), \([0-9]*\)$/\2/p" $tempfile 2> /dev/null` + term_height=$((term_height)) + term_width=$((term_width - 2)) + rm $tempfile + + dialog --backtitle "$FWTS" --title "Test Results" \ + --textbox results.log \ + $term_height $term_width +} + +# +# Shutdown or exit +# +finish() +{ + if [ $SHUTDOWN_AT_END -eq 1 ]; then + dialog --backtitle "$FWTS" --infobox " Shutting down.." 3 30 + shutdown -P now + exit 0 + else + dialog --clear + exit 0 + fi +} + +# +# Aborted, no tests run +# +no_tests_finish() +{ + dialog --backtitle "$FWTS" --title "Abort Testing!" --msgbox \ + " You did not select any tests to be run.\n\n Press Enter to shutdown." 7 50 + finish +} + +# +# Finish after running some tests +# +done_tests_finish() +{ + dialog --backtitle "$FWTS" --title "Testing Complete" --yesno \ +"The results can be found on the USB stick in the\n +the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\n + Do you want to view the results log now?" 9 55 + case $? in + 0) + view_results + ;; + 1|255) + ;; + esac + + dialog --backtitle "$FWTS" --title "Testing Complete" --msgbox \ +"The results can be found on the USB stick in the\n +the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\n + Press Enter to shutdown" 9 55 + finish +} + +# +# Here we go.. +# +mkdir -p $WORK_DIR >& /dev/null +if [ $? -ne 0 ]; then + dialog --ok-label "Shutdown" --backtitle "$FWTS" --title "Error" --msgbox "Could not create directory fwts/$FWTS_DATE/$FWTS_TIME to store test results.\n\n Press Enter to shutdown." 8 50 + finish + exit 0 +fi + +while true +do + dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ + "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ +The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ + 18 70 4 \ + 1 "All Batch Tests" on \ + 2 "Select Individual Tests" off \ + 3 "Abort Testing" off \ + 2> $OPTIONS + + case $? in + 0) + cd $WORK_DIR >& /dev/null + case `cat $OPTIONS` in + '1') + do_test "--batch" 'Running Batch Tests' + done_tests_finish + ;; + '2') + select_tests + ;; + '3') + no_tests_finish + ;; + esac + ;; + 2) + do_help + ;; + 1|255) + no_tests_finish + ;; + esac +done