Patchwork [kteam-tools,pull-request] daily-iso-builder script cleanup and adding fwts isos

login
register
mail settings
Submitter Brad Figg
Date July 28, 2010, 7:17 p.m.
Message ID <4C508265.40504@canonical.com>
Download mbox | patch
Permalink /patch/60170/
State Accepted
Delegated to: Tim Gardner
Headers show

Comments

Brad Figg - July 28, 2010, 7:17 p.m.
The following changes since commit 25da875d861c9d65827f122136843d57248191ba:
   Stefan Bader (1):
         cvescripts: cvescritps_lib: Change directories when sourcing cve_lib

are available in the git repository at:

   git://kernel.ubuntu.com/bradf/kteam-tools master

Brad Figg (1):
       1. Added a bunch of comments to the daily-iso-builder script and        pulled many of the constants into variables to make it easier        to customize.

  daily-test-isos/daily-iso-builder.sh   |   69 ++++++++++++++++++++++++++------
  daily-test-isos/mk-custom-iso          |   50 +++++++++++++++++++++-
  daily-test-isos/tests_first_stage_fwts |    6 +++
  daily-test-isos/tests_fwts             |   32 +++++++++++++++
  4 files changed, 142 insertions(+), 15 deletions(-)
  create mode 100644 daily-test-isos/tests_first_stage_fwts
  create mode 100644 daily-test-isos/tests_fwts
Tim Gardner - July 28, 2010, 7:43 p.m.
On 07/28/2010 01:17 PM, Brad Figg wrote:
> git://kernel.ubuntu.com/bradf/kteam-tools master

Looks good, applied.

Patch

diff --git a/daily-test-isos/daily-iso-builder.sh b/daily-test-isos/daily-iso-builder.sh
index bf4b253..03340b0 100644
--- a/daily-test-isos/daily-iso-builder.sh
+++ b/daily-test-isos/daily-iso-builder.sh
@@ -1,22 +1,67 @@ 
  #!/bin/bash
+#
+# This is the script that builds the isos every day.
+#
  set -e
-if [ -e kteam-tools ];then
-    rm -rf kteam-tools
-fi

-git clone git://kernel.ubuntu.com/ubuntu/kteam-tools.git
+BASE=/home/bradf               # Home directory of the user that is building the
+                               # isos.

-wget http://cdimage.ubuntu.com/daily-live/current/maverick-desktop-amd64.iso
-wget http://cdimage.ubuntu.com/daily-live/current/maverick-desktop-i386.iso
+REPOS=$BASE/repos              # Location of any git trees that are needed to build
+                               # the isos.
+
+KTEAM_REPO=$REPOS/kteam-tools  # This is the 'authoritative' copy of the kteam-tools.
+                               # It is only updated after careful review of the latest
+                               # changes.
+
+WORKING_DIR=$BASE/work         # The directory where the 'work' of building the isos
+                               # is done. This directory also contains the directory
+                               # that is mirrored onto zinc.
+
+git clone $KTEAM_REPO
+
+RELEASE=maverick
+DESKTOP_AMD64=$RELEASE-desktop-amd64
+DESKTOP_I386=$RELEASE-desktop-i386
+
+# Fetch the latest daily isos we are going to customize. Note, wget is being
+# used because this build is being done on a system in the DC and the network
+# hose to where the daily-isos are is HUGE.
+#
+wget http://cdimage.ubuntu.com/daily-live/current/$DESKTOP_AMD64.iso
+wget http://cdimage.ubuntu.com/daily-live/current/$DESKTOP_I386.iso

  (
      cd kteam-tools/daily-test-isos
+
+    # Fetch a copy of the kernel teams tests.
+    #
      git clone git://kernel.ubuntu.com/manjo/kernel-qa.git
-    rm -rf kernel-qa/.git
-    rm kernel-qa/tests/video
-    ./mk-custom-iso -i /home/bradf/work/maverick-desktop-i386.iso
-    ./mk-custom-iso -i /home/bradf/work/maverick-desktop-amd64.iso
+    rm -rf kernel-qa/.git    # This is removed to save space.
+    rm kernel-qa/tests/video # FIXME (bjf): removed because of changes to maverick's
+                             #              userspace apps which prevented the test
+                             #              from working. Should be re-evaluated.
+
+    # Build the kernel team's standard, test isos
+    #
+    ./mk-custom-iso -i $WORKING_DIR/$DESKTOP_I386.iso
+    ./mk-custom-iso -i $WORKING_DIR/$DESKTOP_AMD64.iso
+
+    cp /tmp/$DESKTOP_I386-custom.iso  $WORKING_DIR/zinc-mirror/$DESKTOP_I386-ktts.iso
+    cp /tmp/$DESKTOP_AMD64-custom.iso $WORKING_DIR/zinc-mirror/$DESKTOP_AMD64-ktts.iso
+
+    # Build the krenel team's "firmware test suite" enabled test isos
+    #
+    ./mk-custom-iso -f -i $WORKING_DIR/$DESKTOP_I386.iso
+    ./mk-custom-iso -f -i $WORKING_DIR/$DESKTOP_AMD64.iso
+
+    cp /tmp/$DESKTOP_I386-custom.iso  $WORKING_DIR/zinc-mirror/$DESKTOP_I386-fwts.iso
+    cp /tmp/$DESKTOP_AMD64-custom.iso $WORKING_DIR/zinc-mirror/$DESKTOP_AMD64-fwts.iso
  )
-cp /tmp/maverick-desktop-i386-custom.iso  /home/bradf/work/zinc-mirror/
-cp /tmp/maverick-desktop-amd64-custom.iso /home/bradf/work/zinc-mirror/
+
+
+# Cleanup
+#
  rm -rf kteam-tools
+
+# vi:set ts=4 sw=4 expandtab:
diff --git a/daily-test-isos/mk-custom-iso b/daily-test-isos/mk-custom-iso
index b6d49d7..41971c9 100755
--- a/daily-test-isos/mk-custom-iso
+++ b/daily-test-isos/mk-custom-iso
@@ -40,10 +40,11 @@  function cmdline_usage()
      echo "  builds a new ISO. ISOs of the Ubuntu distribution currently in development can be"
      echo "  found at: http://cdimage.ubuntu.com/daily-live/current/"
      echo " "
-    echo "  Usage: ./mkiso -i <reference-iso>"
+    echo "  Usage: ./mkiso -i <reference-iso> [-f]"
      echo "  "
      echo "  Where:"
      echo "    -i <reference-iso>    is the path to the ISO image from which our customized image will originate"
+    echo "    -f                    build ISO image with only firmware test suite included and none of the other tests"
      echo "  "
      echo "  Example:"
      echo "      ./mkiso -i /tmp/ubuntu-9.10-desktop-amd64.iso"
@@ -56,7 +57,7 @@  function cmdline_usage()
  #
  function cmdline_process()
  {
-    while getopts "i:d:" option; do
+    while getopts "i:d:f" option; do
          case $option in
              i)  ISO="$OPTARG"
                  ;;
@@ -64,6 +65,9 @@  function cmdline_process()
              d)  DEB_DIR="$OPTARG"
                  ;;

+	    f)  FWTS_TEST=1
+                ;;
+
              \?) echo -e "\n   *** Error: '$OPTARG' is not a valid option.\n"
                  cmdline_usage
                  exit 1
@@ -156,6 +160,7 @@  function new_iso_remove_pkgs()
      # Remove packages we are not going to need to test with and are
      # big, thus reducing our size.
      #
+    set -x
      sudo chroot $CHROOT sudo apt-get purge -y gimp
      sudo chroot $CHROOT sudo apt-get purge -y gnome-mahjongg gbrainy aisleriot quadrapassel gnome-sudoku
      sudo chroot $CHROOT sudo apt-get purge -y f-spot
@@ -183,6 +188,18 @@  function new_iso_remove_pkgs()
      sudo chroot $CHROOT sudo apt-get purge -y hunspell-en-ca hunspell-en-us
      sudo chroot $CHROOT sudo apt-get purge -y wbritish
      sudo chroot $CHROOT sudo apt-get purge -y aspell-en wamerican
+    sudo chroot $CHROOT sudo apt-get purge -y gwibber
+    sudo chroot $CHROOT sudo apt-get purge -y empathy
+    sudo chroot $CHROOT sudo apt-get purge -y tomboy
+    sudo chroot $CHROOT sudo apt-get purge -y totem
+    sudo chroot $CHROOT sudo apt-get purge -y gnomine
+    sudo chroot $CHROOT sudo apt-get purge -y brasero
+    sudo chroot $CHROOT sudo apt-get purge -y ubuntuone-client-gnome
+    sudo chroot $CHROOT sudo apt-get purge -y simple-scan
+    sudo chroot $CHROOT sudo apt-get purge -y vinagre
+    sudo chroot $CHROOT sudo apt-get purge -y tsclient
+    sudo chroot $CHROOT sudo apt-get purge -y rhythmbox
+    sudo chroot $CHROOT sudo apt-get purge -y evolution
  }

  # new_iso_add_kernel_team_tests
@@ -227,6 +244,29 @@  function new_iso_add_kernel_team_tests()
      sudo chmod +x $CHROOT/home/ubuntu/kernel-qa/tests_starter
  }

+# new_iso_add_kernel_team_fwts_tests
+#
+# Install the firmware test suite tests into the custom iso and setup the default
+# login to automatically run the tests.
+#
+function new_iso_add_kernel_team_fwts_tests()
+{
+    sudo chroot $CHROOT sudo add-apt-repository ppa:firmware-testing-team/ppa-firmware-test-suite
+    sudo chroot $CHROOT sudo apt-get update
+    sudo chroot $CHROOT sudo apt-get install -y --force-yes fwts
+
+    # Setup the autostart file so that as soon as the ubuntu user's
+    # desktop starts up, the tests start as well.
+    sudo mkdir -p $CHROOT/home/ubuntu/.config/autostart/
+    sudo cp $CWD/checkbox-kernel-qa.desktop $CHROOT/home/ubuntu/.config/autostart/
+    sudo cp $CWD/tests_first_stage_fwts $CHROOT/home/ubuntu/tests_first_stage
+    sudo cp $CWD/tests_fwts $CHROOT/home/ubuntu/tests_fwts
+    sudo chown 999.999 $CHROOT/home/ubuntu/tests_first_stage
+    sudo chown 999.999 $CHROOT/home/ubuntu/tests_fwts
+    sudo chmod +x $CHROOT/home/ubuntu/tests_first_stage
+    sudo chmod +x $CHROOT/home/ubuntu/tests_fwts
+}
+
  # new_iso_initialize
  #
  # Extract the squashfs from the ISO and start building up the custom ISO
@@ -283,7 +323,11 @@  function new_iso_customize()

      sudo chroot $CHROOT sudo apt-get install -y patch

-    new_iso_add_kernel_team_tests
+    if [ -z "$FWTS_TEST" ]; then
+        new_iso_add_kernel_team_tests
+    else
+        new_iso_add_kernel_team_fwts_tests
+    fi
  }

  # new_iso_prepare_for_assemble
diff --git a/daily-test-isos/tests_first_stage_fwts b/daily-test-isos/tests_first_stage_fwts
new file mode 100644
index 0000000..50a60da
--- /dev/null
+++ b/daily-test-isos/tests_first_stage_fwts
@@ -0,0 +1,6 @@ 
+#!/bin/sh
+
+# Assume that this is the first time and we are running
+# off of a flash drive.
+#
+sudo gnome-terminal --full-screen -e /home/ubuntu/tests_fwts
diff --git a/daily-test-isos/tests_fwts b/daily-test-isos/tests_fwts
new file mode 100644
index 0000000..d8709c1
--- /dev/null
+++ b/daily-test-isos/tests_fwts
@@ -0,0 +1,32 @@ 
+#!/bin/bash
+cd /cdrom
+fwtsdate=`date +%d%m%Y`
+fwtstime=`date +%H%M`
+workdir=/isodevice/fwts/$fwtsdate/$fwtstime
+mkdir -p $workdir >& /dev/null
+if [ $? -ne 0 ]
+then
+  echo Could not create directory $workdir
+  echo "Press <Enter> Key"
+  read
+  shutdown -h now
+else
+  echo "=========== Firmware Test Suite (fwts) ==========="
+  echo " "
+  echo "This will run a suite of firmware tests that will"
+  echo "check the BIOS and ACPI tables. It will also find"
+  echo "issues that can cause Linux problems. "
+  echo " "
+  echo "At the end of the tests, the machine will automatically"
+  echo "shutdown. "
+  echo " "
+  echo "The results can be found on the USB stick in the"
+  echo "directory: /fwts/$fwtsdate/$fwtstime/results.log"
+  echo " "
+  echo "Press <Enter> key to start the tests..."
+  read
+  cd $workdir >& /dev/null
+  fwts --no-s3 --no-s4 -p
+  shutdown -h now
+fi
+