The samples are one of the first contacts that new users
have with autotest, hence, we need to keep them well maintained
and up to date. This patch gives an overhaul on the existing
samples, updates them with new APIs and make them follow the
autotest control file specification.

Some control files showing up simple features were merged
with more complete ones, so we hopefully end with something
more organized and understandable.

The plan is to do the same with the server side ones, fixing
eventual problems found. Will also try to keep testing them
against the latest trunk/git HEAD so we try to keep
regressions at a minimum.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/samples/all_tests                   |   23 ----------
 client/samples/autotest_console            |   16 -------
 client/samples/build                       |    6 ---
 client/samples/build2                      |   12 -----
 client/samples/control.alt_tags            |   33 ++++++++++++++
 client/samples/control.fs                  |   32 +++++++++++++
 client/samples/control.fs_options          |   36 +++++++++++++++
 client/samples/control.interactive_console |   25 ++++++++++
 client/samples/control.kbuild_and_tests    |   66 ++++++++++++++++++++++++++++
 client/samples/control.oprofile            |   24 ++++++++++
 client/samples/control.oprofile_power5     |   43 ++++++++++++++++++
 client/samples/control.parallel            |   20 ++++++++
 client/samples/control.patch_verify        |   42 ++++++++++++++++++
 client/samples/control.profilers           |   24 ++++++++++
 client/samples/control.rpm_kernel          |   22 +++++++++
 client/samples/control.soft_reboot         |   29 ++++++++++++
 client/samples/control.xenbuild            |   31 +++++++++++++
 client/samples/ext3_options                |   20 --------
 client/samples/filesystem                  |   25 ----------
 client/samples/kernelexpand                |    1 -
 client/samples/mirror                      |    3 -
 client/samples/oprofile                    |   11 -----
 client/samples/oprofile.power5+            |   24 ----------
 client/samples/parallel                    |    7 ---
 client/samples/parallel_dd                 |   22 ---------
 client/samples/profilers                   |    9 ----
 client/samples/reboot                      |    1 -
 client/samples/rpm_kernel                  |    9 ----
 client/samples/soft_reboot                 |   24 ----------
 client/samples/test_add_kernel             |   19 --------
 client/samples/test_install                |    7 ---
 client/samples/test_job                    |   18 --------
 client/samples/test_xenbuild               |   38 ----------------
 33 files changed, 427 insertions(+), 295 deletions(-)
 delete mode 100644 client/samples/all_tests
 delete mode 100644 client/samples/autotest_console
 delete mode 100644 client/samples/build
 delete mode 100644 client/samples/build2
 create mode 100644 client/samples/control.alt_tags
 create mode 100644 client/samples/control.fs
 create mode 100644 client/samples/control.fs_options
 create mode 100644 client/samples/control.interactive_console
 create mode 100644 client/samples/control.kbuild_and_tests
 create mode 100644 client/samples/control.oprofile
 create mode 100644 client/samples/control.oprofile_power5
 create mode 100644 client/samples/control.parallel
 create mode 100644 client/samples/control.patch_verify
 create mode 100644 client/samples/control.profilers
 create mode 100644 client/samples/control.rpm_kernel
 create mode 100644 client/samples/control.soft_reboot
 create mode 100644 client/samples/control.xenbuild
 delete mode 100644 client/samples/ext3_options
 delete mode 100644 client/samples/filesystem
 delete mode 100644 client/samples/kernelexpand
 delete mode 100644 client/samples/mirror
 delete mode 100644 client/samples/oprofile
 delete mode 100644 client/samples/oprofile.power5+
 delete mode 100644 client/samples/parallel
 delete mode 100644 client/samples/parallel_dd
 delete mode 100644 client/samples/profilers
 delete mode 100644 client/samples/reboot
 delete mode 100644 client/samples/rpm_kernel
 delete mode 100644 client/samples/soft_reboot
 delete mode 100644 client/samples/test_add_kernel
 delete mode 100644 client/samples/test_install
 delete mode 100644 client/samples/test_job
 delete mode 100644 client/samples/test_xenbuild

diff --git a/client/samples/all_tests b/client/samples/all_tests
deleted file mode 100644
index 88923ad..0000000
--- a/client/samples/all_tests
+++ /dev/null
@@ -1,23 +0,0 @@
-job.run_test('aiostress')
-job.run_test('bonnie')
-job.run_test('dbench')
-job.run_test('fio')
-job.run_test('fsx')
-job.run_test('interbench')
-job.run_test('isic')
-job.run_test('kernbench', iterations=2, threads=5)
-job.run_test('lmbench')
-job.run_test('ltp')
-
-job.run_test('reaim')
-job.run_test('scrashme')
-job.run_test('sleeptest')
-testkernel = job.kernel('/usr/local/src/linux-2.6.14.tar.bz2') # '2.6.14'
-testkernel.patch('/usr/local/src/patch-2.6.14-git6.bz2')
-testkernel.config('http://ftp.kernel.org/pub/linux/kernel/people/mbligh/config/config.up')
-job.run_test('sparse', testkernel)
-
-job.run_test('stress')
-job.run_test('tbench')
-job.run_test('unixbench')
-job.run_test('xmtest', args='-e [email protected] -d xmtest')
diff --git a/client/samples/autotest_console b/client/samples/autotest_console
deleted file mode 100644
index 3825323..0000000
--- a/client/samples/autotest_console
+++ /dev/null
@@ -1,16 +0,0 @@
-# autotest_console.control - gives you an interactive interpreter within an
-# autotest control file.
-
-# If you install IPython (http://ipython.scipy.org/, Ubuntu package "ipython"),
-# you'll get a snazzy IPython console with readline and completion and all 
that.
-# Otherwise you'll get a simple console without any of that.
-
-# -Steve Howard ([email protected])
-
-try:
-       import IPython
-       ipshell = IPython.Shell.IPShellEmbed(argv=[])
-       ipshell()
-except ImportError:
-       import code
-       code.interact('Autotest console', raw_input, local_env)
diff --git a/client/samples/build b/client/samples/build
deleted file mode 100644
index eaa75a1..0000000
--- a/client/samples/build
+++ /dev/null
@@ -1,6 +0,0 @@
-print "TEST: initing kernel"
-testkernel = job.kernel('2.6.18')
-testkernel.config('http://mbligh.org/config/opteron2')
-
-print "TEST: building kernel"
-testkernel.build()
diff --git a/client/samples/build2 b/client/samples/build2
deleted file mode 100644
index 27bbcd6..0000000
--- a/client/samples/build2
+++ /dev/null
@@ -1,12 +0,0 @@
-print "TEST: initing kernel 1"
-testkernel = job.kernel('/usr/local/src/linux-2.6.17.tar.bz2') # '2.6.17'
-testkernel.config('http://mbligh.org/config/opteron2')
-print "TEST: building kernel 1"
-testkernel.build()
-
-print "TEST: initing kernel 2"
-testkernel = job.kernel('/usr/local/src/linux-2.6.18.tar.bz2') # '2.6.18'
-testkernel.config('http://mbligh.org/config/opteron2')
-print "TEST: building kernel 2"
-testkernel.build()
-
diff --git a/client/samples/control.alt_tags b/client/samples/control.alt_tags
new file mode 100644
index 0000000..37cf733
--- /dev/null
+++ b/client/samples/control.alt_tags
@@ -0,0 +1,33 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "MEDIUM"
+NAME = "Sample - Building and adding an alternate kernel"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Builds a test kernel, then runs the kernbench test. This sample shows the
+job.bootloader object, as well as building kernels with alternate idenfifying
+tags.
+"""
+
+def step_init():
+    """
+    Build a kernel from kernel.org. This step will be executed, the machine
+    will be rebooted and then we'll proceed with step_tests.
+    """
+    job.next_step([step_tests])
+    testkernel = job.kernel('2.6.35')
+    # This is the default config that can be retrieved on gitweb
+    
testkernel.config('http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob_plain;f=arch/x86/configs/x86_64_defconfig;h=6c86acd847a4e28c09d951b34d488b13d44df3c7;hb=ea8a52f9f4bcc3420c38ae07f8378a2f18443970')
+    testkernel.build()
+    testkernel.install('autotest-alternate')
+    job.bootloader.list_titles()
+    testkernel.boot('autotest-alternate')
+
+
+def step_tests():
+    """
+    Run a series of autotest tests on this machine.
+    """
+    job.run_test('kernbench', iterations=2, threads=5)
diff --git a/client/samples/control.fs b/client/samples/control.fs
new file mode 100644
index 0000000..a0a65c7
--- /dev/null
+++ b/client/samples/control.fs
@@ -0,0 +1,32 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "MEDIUM"
+NAME = "Sample - Filesystem tests with different filesystems"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs a series of filesystem tests on a loopback partition using different
+filesystem types. his shows some features of the job.partition method, such as
+creating loopback partitions instead of using real disk partitions, looping.
+"""
+
+partition = job.partition('/tmp/looped', 1024, job.tmpdir)
+# You can use also 'real' partitions, just comment the above and uncomment
+# the below
+#partition = job.partition('/dev/sdb1', job.tmpdir)
+
+def test_fs():
+    partition.mkfs(fstype)
+    partition.mount()
+    try:
+        job.run_test('fsx', dir=partition.mountpoint, tag=fstype)
+        job.run_test('iozone', dir=partition.mountpoint, tag=fstype)
+        job.run_test('dbench', dir=partition.mountpoint, tag=fstype)
+    finally:
+        partition.unmount()
+        partition.fsck()
+
+
+for fstype in ('ext2', 'ext3', 'jfs', 'xfs', 'reiserfs'):
+    job.run_group(test_fs)
diff --git a/client/samples/control.fs_options 
b/client/samples/control.fs_options
new file mode 100644
index 0000000..e126c3c
--- /dev/null
+++ b/client/samples/control.fs_options
@@ -0,0 +1,36 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "MEDIUM"
+NAME = "Sample - Filesystem tests with different fs options"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs a series of filesystem tests on a loopback partition. This shows some
+features of the job.partition method, such as creating loopback partitions
+instead of using real disk partitions, looping and tags.
+"""
+
+partition = job.partition(device='/tmp/looped', loop_size=1024,
+                          mountpoint=job.tmpdir)
+# You can use also 'real' partitions, just comment the above and uncomment
+# the below
+#partition = job.partition('/dev/sdb1', job.tmpdir)
+
+iters = 10
+
+for fstype, mountopts, tag in (('ext2', '', 'ext2'),
+                               ('ext3', '-o data=writeback', 'ext3writeback'),
+                               ('ext3', '-o data=ordered', 'ext3ordered'),
+                               ('ext3', '-o data=journal', 'ext3journal'),
+                               ('ext4', '-o data=ordered', 'ext4ordered'),
+                               ('ext4', '-o data=journal', 'ext4journal'),):
+    partition.mkfs(fstype)
+    partition.mount(args=mountopts)
+    try:
+        job.run_test('fsx', dir=job.tmpdir, tag=tag)
+        job.run_test('iozone', dir=job.tmpdir, iterations=iters, tag=tag)
+        job.run_test('dbench', iterations=iters, dir=job.tmpdir, tag=tag)
+        job.run_test('tiobench', dir=job.tmpdir, tag=tag)
+    finally:
+        partition.unmount()
diff --git a/client/samples/control.interactive_console 
b/client/samples/control.interactive_console
new file mode 100644
index 0000000..75b09ab
--- /dev/null
+++ b/client/samples/control.interactive_console
@@ -0,0 +1,25 @@
+AUTHOR = "Steve Howard <[email protected]>"
+TIME = "SHORT"
+NAME = "Sample - Autotest console"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Gives you an interactive interpreter within an autotest control file.
+
+If you install IPython (http://ipython.scipy.org/, Ubuntu and Fedora's package
+"ipython"), you'll get a snazzy IPython console with readline and completion
+and all that. Otherwise you'll get a simple python console.
+
+The point of this control file is to give you an interactive interpreter with
+all autotest 'magic' loaded in, so you can inspect objects and have fun.
+"""
+
+try:
+    import IPython
+    ipshell = IPython.Shell.IPShellEmbed(argv=[], banner='autotest console')
+    ipshell()
+except ImportError:
+    import code
+    code.interact('autotest console', raw_input)
diff --git a/client/samples/control.kbuild_and_tests 
b/client/samples/control.kbuild_and_tests
new file mode 100644
index 0000000..59dd757
--- /dev/null
+++ b/client/samples/control.kbuild_and_tests
@@ -0,0 +1,66 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "MEDIUM"
+NAME = "Sample - Kernel tests"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Builds a test kernel, then runs a series of tests on it. This control file 
shows
+features such as:
+
+ * The step engine - autotest mechanism of executing jobs in steps, where you
+   can interrupt the flow of execution with client reboots, in order to boot
+   newly built kernels
+ * Downloading, configuring, patching, building and booting a kernel straight
+   from kernel.org.
+ * Kernel expand - provide a string such as '2.6.36-git13' and have autotest to
+   expand that and download the proper source tarballs and patches
+   automatically.
+ * Local kernel.org mirror - Alternate kernel.org mirror that you can set on
+   your control file.
+"""
+
+def step_init():
+    """
+    Build a kernel from kernel.org. This step will be executed, the machine
+    will be rebooted and then we'll proceed with step_tests.
+    """
+    job.next_step([step_tests])
+    # If you have a local/different kernel.org mirror, you can set it by
+    # uncommenting the below and set the URL properly.
+    #job.config_set('local_mirror', 'http://foo/bar')
+    testkernel = job.kernel('2.6.35')
+    # If you want to see kernel expansion in action, comment the above and
+    # uncomment the below. Keep in mind that after some months, it's expected
+    # that some of the patches might not exist, so you might want to edit
+    # this to satisfy your needs.
+    #testkernel = job.kernel('2.6.36-git13')
+    # You can provide a path to an uncompressed kernel source as well
+    #testkernel = job.kernel('/path/to/kernel-source')
+    
testkernel.patch('http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.35.7.bz2')
+    # This is the default config that can be retrieved on gitweb
+    
testkernel.config('http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob_plain;f=arch/x86/configs/x86_64_defconfig;h=6c86acd847a4e28c09d951b34d488b13d44df3c7;hb=ea8a52f9f4bcc3420c38ae07f8378a2f18443970')
+    testkernel.build()
+    testkernel.boot()
+
+
+def step_tests():
+    """
+    Run a series of autotest tests on this machine.
+    """
+    job.run_test('aiostress')
+    job.run_test('bonnie')
+    job.run_test('dbench')
+    job.run_test('fio')
+    job.run_test('fsx')
+    job.run_test('interbench')
+    job.run_test('isic')
+    job.run_test('kernbench', iterations=2, threads=5)
+    job.run_test('lmbench')
+    job.run_test('ltp')
+    job.run_test('reaim')
+    job.run_test('sparse')
+    job.run_test('stress')
+    job.run_test('tbench')
+    job.run_test('unixbench')
diff --git a/client/samples/control.oprofile b/client/samples/control.oprofile
new file mode 100644
index 0000000..db5730a
--- /dev/null
+++ b/client/samples/control.oprofile
@@ -0,0 +1,24 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "MEDIUM"
+NAME = "Sample - Using profilers"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs our sleeptest (bogus test that only sleeps for a given amount of time),
+while running the oprofile profilers, with and without special parameters
+passed to the profiler.
+"""
+
+import logging
+
+logging.info("Testing default event")
+job.profilers.add('oprofile')
+job.run_test('sleeptest', seconds=5, tag='default')
+job.profilers.delete('oprofile')
+
+logging.info("Testing ICACHE_MISSES")
+job.profilers.add('oprofile', 'ICACHE_MISSES:100000')
+job.run_test('sleeptest', seconds=5, tag='icache_misses')
+job.profilers.delete('oprofile')
diff --git a/client/samples/control.oprofile_power5 
b/client/samples/control.oprofile_power5
new file mode 100644
index 0000000..18eecc9
--- /dev/null
+++ b/client/samples/control.oprofile_power5
@@ -0,0 +1,43 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "MEDIUM"
+NAME = "Sample - Using oprofile - specific power5 options"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs our sleeptest (bogus test that only sleeps for a given amount of time),
+while running the oprofile profilers, with and without special parameters
+passed to the profiler. This particular control shows special features of
+oprofile under power 5 cpu architecture.
+"""
+
+import logging
+
+logging.info("Testing default event")
+job.profilers.add('oprofile')
+job.run_test('sleeptest', seconds=5, tag='default')
+job.profilers.delete('oprofile')
+
+logging.info("Testing specified vmlinux")
+job.profilers.add('oprofile', '/boot/vmlinux-autotest')
+job.run_test('sleeptest', seconds=5, tag='vmlinux')
+job.profilers.delete('oprofile')
+
+logging.info("Testing one event")
+job.profilers.add('oprofile', None, ['PM_RUN_CYC_GRP153:100000'])
+job.run_test('sleeptest', seconds=5, tag='one')
+job.profilers.delete('oprofile')
+
+logging.info("Testing multiple events")
+job.profilers.add('oprofile', None,
+                  ['PM_RUN_CYC_GRP153:100000', 'PM_INST_CMPL_GRP153:10000'])
+job.run_test('sleeptest', seconds=5, tag='multi')
+job.profilers.delete('oprofile')
+
+logging.info("Testing other args")
+job.profilers.add('oprofile', None,
+                  ['PM_RUN_CYC_GRP153:150000', 'PM_INST_CMPL_GRP153:150000'],
+                  '--callgraph=3')
+job.run_test('sleeptest', seconds=5, tag='other')
+job.profilers.delete('oprofile')
diff --git a/client/samples/control.parallel b/client/samples/control.parallel
new file mode 100644
index 0000000..47a5ac9
--- /dev/null
+++ b/client/samples/control.parallel
@@ -0,0 +1,20 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "SHORT"
+NAME = "Sample - Parallel test execution"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs 2 client tests in parallel, with different options.
+"""
+
+def kernbench():
+    job.run_test('kernbench', iterations=2, threads=5)
+
+
+def dbench():
+    job.run_test('dbench')
+
+
+job.parallel([kernbench], [dbench])
diff --git a/client/samples/control.patch_verify 
b/client/samples/control.patch_verify
new file mode 100644
index 0000000..a03e93b
--- /dev/null
+++ b/client/samples/control.patch_verify
@@ -0,0 +1,42 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "SHORT"
+NAME = "Sample - Parallel dd with kernel build - patch verification"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Parallel dd test with kernel build with the objective of seeing (or not)
+differences after a patch is applied to the mainline kernel.
+"""
+
+def tests(tag):
+    partition = job.partition('/tmp/looped', 1024, job.tmpdir)
+    # You can use also 'real' partitions, just comment the above and uncomment
+    # the below
+    #partition = job.partition('/dev/sdb1', job.tmpdir)
+
+    job.run_test('parallel_dd', fs=partition, fs_type='ext4', iterations=1,
+                 megabytes=1000, streams=2, tag=tag)
+
+
+def step_init():
+    testkernel = job.kernel('/usr/src/linux-2.6.36.tar.bz2')
+    testkernel.config('/usr/src/config')
+    testkernel.build()
+    job.next_step([step_one])
+    testkernel.boot()
+
+
+def step_one():
+    tests('mainline')
+    testkernel = job.kernel('/usr/src/linux-2.6.36.tar.bz2')
+    testkernel.patch('/usr/src/ext4_patch')
+    testkernel.config('/usr/src/config')
+    testkernel.build()
+    job.next_step([step_two])
+    testkernel.boot()
+
+
+def step_two():
+    tests('post_patch')
diff --git a/client/samples/control.profilers b/client/samples/control.profilers
new file mode 100644
index 0000000..5ed545f
--- /dev/null
+++ b/client/samples/control.profilers
@@ -0,0 +1,24 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "SHORT"
+NAME = "Sample - More profilers"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs sleeptest with differnt profilers present in the autotest tree. Also,
+it shows the convenience logging methods, such as logging.info and
+logging.error.
+"""
+
+import logging
+
+for profiler in ('readprofile', 'oprofile', 'catprofile', 'lockmeter'):
+    try:
+        logging.info("Testing profiler %s", profiler)
+        job.profilers.add(profiler)
+        job.run_test('sleeptest', seconds=5, tag=profiler)
+        job.profilers.delete(profiler)
+    except:
+        logging.error("Test of profiler %s failed", profiler)
+        raise
diff --git a/client/samples/control.rpm_kernel 
b/client/samples/control.rpm_kernel
new file mode 100644
index 0000000..d3dc8b3
--- /dev/null
+++ b/client/samples/control.rpm_kernel
@@ -0,0 +1,22 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = "SHORT"
+NAME = "Sample - More profilers"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+TEST_CATEGORY = "Functional"
+
+DOC = """
+Runs sleeptest after installing a kernel rpm. Please note that syntax works
+only if you have an autotest package repository properly setup.
+"""
+
+def step_init():
+    job.next_step([step_test])
+    # The below won't work unless you have configured an autotest package
+    # repository.
+    testkernel = job.kernel('kernel-smp-2.6.18-210.4.x86_64.rpm')
+    testkernel.install()
+    testkernel.boot() # does autotest by default
+
+def step_test():
+    job.run_test('sleeptest')
diff --git a/client/samples/control.soft_reboot 
b/client/samples/control.soft_reboot
new file mode 100644
index 0000000..30f3403
--- /dev/null
+++ b/client/samples/control.soft_reboot
@@ -0,0 +1,29 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = 'MEDIUM'
+NAME = "Sample - Machine reboot"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+
+DOC = """
+This test will reboot the machine ITERATIONS number of times.  Note that if you
+use this, you'll need to use the step engine for any tests that occur after
+this one.  This means that this may not play well when run from the autotest
+front end.
+"""
+
+ITERATIONS = 5
+
+tries = job.get_state('soft_reboot_tries', 0) + 1
+job.set_state("soft_reboot_tries", tries)
+
+if tries < ITERATIONS:
+    import sys
+    this_functions_name = sys._getframe().f_code.co_name
+    if this_functions_name != "?":
+        # If we're not in a function (i.e. we get "?") then we're
+        # not using the step engine and thus no next step is
+        # necessary
+        job.next_step_prepend(this_functions_name)
+
+if tries <= ITERATIONS:
+    job.reboot()
diff --git a/client/samples/control.xenbuild b/client/samples/control.xenbuild
new file mode 100644
index 0000000..12e09f3
--- /dev/null
+++ b/client/samples/control.xenbuild
@@ -0,0 +1,31 @@
+AUTHOR = "Autotest Team <[email protected]>"
+TIME = 'MEDIUM'
+NAME = "Sample - Xen Build"
+TEST_TYPE = "client"
+TEST_CLASS = "Kernel"
+
+DOC = """
+this is a sample job to build xen and kernel with xen patches.
+The xen unstable tarball comes with scripts that will automatically
+patch a linux kernel, however, in some cases, PPC for example, the
+kernel is built from a seperate source.  The xen class supports
+defining your own kernel job, and handing that to the xen job.  If
+no kernel job is specified, it will create one using the kernel source
+that the xen tarball uses.
+"""
+
+def step_init():
+    xensrc = 
'http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-unstable-src.tgz'
+    # Uncomment the lines below if you want to build an alternate kernel
+    #testkernel = job.kernel('/usr/local/src/linux-2.6.18.tar.bz2')
+    #testkernel.config('http://mbligh.org/config/opteron2')
+    #testxen = job.xen(xensrc, kjob = testkernel)
+    testxen = job.xen(xensrc)
+    testxen.build()
+    testxen.install(tag='autotest', prefix='/tmp/xen')
+    # Uncomment the line below if you want to boot your newly built kernel
+    testxen.boot()
+
+
+def step_test():
+    job.run_test('sleeptest')
diff --git a/client/samples/ext3_options b/client/samples/ext3_options
deleted file mode 100644
index 7e7cf2c..0000000
--- a/client/samples/ext3_options
+++ /dev/null
@@ -1,20 +0,0 @@
-fs = job.filesystem('/dev/sda3', job.tmpdir)
-
-iters=10
-
-for fstype, mountopts, tag in (('ext2', '', 'ext2'),
-                              ('ext3', '-o data=writeback', 'ext3writeback'),
-                              ('ext3', '-o data=ordered', 'ext3ordered'),
-                              ('ext3', '-o data=journal', 'ext3journal')):
-       fs.mkfs(fstype)
-       fs.mount(args=mountopts)
-       try:
-               job.run_test('fsx', dir=job.tmpdir, tag=tag)
-               job.run_test('iozone', dir=job.tmpdir, iterations=iters, 
tag=tag)
-               job.run_test('dbench',
-                            iterations=iters,
-                            dir=job.tmpdir,
-                            tag=tag)
-               job.run_test('tiobench', dir=job.tmpdir, tag=tag)
-       finally:
-               fs.unmount()
diff --git a/client/samples/filesystem b/client/samples/filesystem
deleted file mode 100644
index 2fd1b9d..0000000
--- a/client/samples/filesystem
+++ /dev/null
@@ -1,25 +0,0 @@
-# Uncomment this line, and replace the device with something sensible
-# for you ...
-# fs = job.partition('/dev/hda2', job.tmpdir)
-# or ...
-
-part = job.partition('/tmp/looped', 1024, job.tmpdir)
-
-# dbench 1024, ltp, 1024-byte blocksize, a few other things.  Lots of fscking.
-# I haven't tested nobh mode yet, 
-# and I have yet to point run-bash-shared-mapping at it.
-# (different mount options for ext3)
-
-def test_fs():
-       part.mkfs(fstype)
-       part.mount()
-       try:
-               job.run_test('fsx', dir=part.mountpoint, tag=fstype)
-               job.run_test('iozone', dir=part.mountpoint, tag=fstype)
-               job.run_test('dbench', dir=part.mountpoint, tag=fstype)
-       finally:
-               part.unmount()
-               part.fsck()
-
-for fstype in ('ext2', 'ext3', 'jfs', 'xfs', 'reiserfs'):
-       job.run_group(test_fs)
diff --git a/client/samples/kernelexpand b/client/samples/kernelexpand
deleted file mode 100644
index bdc4daa..0000000
--- a/client/samples/kernelexpand
+++ /dev/null
@@ -1 +0,0 @@
-testkernel = job.kernel('2.6.18-rc7-git1')
diff --git a/client/samples/mirror b/client/samples/mirror
deleted file mode 100644
index 297a64c..0000000
--- a/client/samples/mirror
+++ /dev/null
@@ -1,3 +0,0 @@
-testkernel = job.kernel('2.6.14-rc1-mm1')
-job.config_set('local_mirror', 'http://foo/bar')
-testkernel = job.kernel('2.6.14-rc1-mm1')
diff --git a/client/samples/oprofile b/client/samples/oprofile
deleted file mode 100644
index 42c0d36..0000000
--- a/client/samples/oprofile
+++ /dev/null
@@ -1,11 +0,0 @@
-print "Testing default event"
-
-job.profilers.add('oprofile')
-job.run_test('sleeptest', seconds=1, tag='default')
-job.profilers.delete('oprofile')
-
-print "Testing ICACHE_MISSES"
-
-job.profilers.add('oprofile', 'ICACHE_MISSES:100000')
-job.run_test('sleeptest', seconds=1, tag='icache_misses')
-job.profilers.delete('oprofile')
diff --git a/client/samples/oprofile.power5+ b/client/samples/oprofile.power5+
deleted file mode 100644
index 7a84fa2..0000000
--- a/client/samples/oprofile.power5+
+++ /dev/null
@@ -1,24 +0,0 @@
-print "Testing default event"
-job.profilers.add('oprofile')
-job.run_test('sleeptest', seconds=1, tag='default')
-job.profilers.delete('oprofile')
-
-print "Testing specified vmlinux"
-job.profilers.add('oprofile', '/boot/vmlinux-autotest')
-job.run_test('sleeptest', seconds=1, tag='vmlinux')
-job.profilers.delete('oprofile')
-
-print "Testing one event"
-job.profilers.add('oprofile', None, ['PM_RUN_CYC_GRP153:100000'])
-job.run_test('sleeptest', seconds=1, tag='one')
-job.profilers.delete('oprofile')
-
-print "Testing multiple events"
-job.profilers.add('oprofile', None, ['PM_RUN_CYC_GRP153:100000', 
'PM_INST_CMPL_GRP153:10000'])
-job.run_test('sleeptest', seconds=1, tag='multi')
-job.profilers.delete('oprofile')
-
-print "Testing other args"
-job.profilers.add('oprofile', None, ['PM_RUN_CYC_GRP153:150000', 
'PM_INST_CMPL_GRP153:150000'], '--callgraph=3')
-job.run_test('sleeptest', seconds=1, tag='other')
-job.profilers.delete('oprofile')
diff --git a/client/samples/parallel b/client/samples/parallel
deleted file mode 100644
index c871039..0000000
--- a/client/samples/parallel
+++ /dev/null
@@ -1,7 +0,0 @@
-def kernbench():
-       job.run_test('kernbench', iterations=2, threads=5)
-
-def dbench():
-       job.run_test('dbench')
-
-job.parallel([kernbench], [dbench])
diff --git a/client/samples/parallel_dd b/client/samples/parallel_dd
deleted file mode 100644
index 57e712b..0000000
--- a/client/samples/parallel_dd
+++ /dev/null
@@ -1,22 +0,0 @@
-def tests(tag):
-       fs = job.filesystem('/dev/sda3', job.tmpdir)
-       job.run_test('parallel_dd', fs=fs, fs_type='ext2', iterations=1, 
megabytes=1000, streams=2, tag=tag)
-
-def step_init():
-       testkernel = job.kernel('/usr/src/linux-2.6.18.tar.bz2')
-       testkernel.config('/usr/src/config')
-       testkernel.build()
-       job.next_step([step_one])
-       testkernel.boot()
-
-def step_one():
-       tests('mainline')
-       testkernel = job.kernel('/usr/src/linux-2.6.18.tar.bz2')
-       testkernel.patch('/usr/src/ext2_reservations')
-       testkernel.config('/usr/src/config')
-       testkernel.build()
-       job.next_step([step_two])
-       testkernel.boot()
-
-def step_two():
-       tests('extents')
diff --git a/client/samples/profilers b/client/samples/profilers
deleted file mode 100644
index 949ddd6..0000000
--- a/client/samples/profilers
+++ /dev/null
@@ -1,9 +0,0 @@
-for profiler in ('readprofile', 'oprofile', 'catprofile', 'lockmeter'):
-       try:
-               print "Testing profiler %s ..." % profiler
-               job.profilers.add(profiler)
-               job.run_test('sleeptest', seconds=3, tag=profiler)
-               job.profilers.delete(profiler)
-       except:
-               print "Test of profiler %s failed" % profiler
-               raise
diff --git a/client/samples/reboot b/client/samples/reboot
deleted file mode 100644
index b0daab3..0000000
--- a/client/samples/reboot
+++ /dev/null
@@ -1 +0,0 @@
-job.reboot()
diff --git a/client/samples/rpm_kernel b/client/samples/rpm_kernel
deleted file mode 100644
index 0aa8616..0000000
--- a/client/samples/rpm_kernel
+++ /dev/null
@@ -1,9 +0,0 @@
-def step_init():
-        job.next_step([step_test])
-       testkernel = job.kernel('kernel-smp-2.6.18-210.4.x86_64.rpm')
-       testkernel.install()
-       testkernel.boot()          # does autotest by default
-
-def step_test():
-       print "TEST: sleeptest"
-        job.run_test('sleeptest')
diff --git a/client/samples/soft_reboot b/client/samples/soft_reboot
deleted file mode 100644
index c5d6727..0000000
--- a/client/samples/soft_reboot
+++ /dev/null
@@ -1,24 +0,0 @@
-TIME = 'MEDIUM'
-DOC = """\
-This test will reboot the machine ITERATIONS number of times.  Note that if you
-use this, you'll need to use the step engine for any tests that occur after
-this one.  This means that this may not play well when run from the autotest
-front end."""
-
-
-ITERATIONS = 5
-
-tries = job.get_state('soft_reboot_tries', 0) + 1
-job.set_state("soft_reboot_tries", tries)
-
-if tries < ITERATIONS:
-       import sys
-       this_functions_name = sys._getframe().f_code.co_name
-       if this_functions_name != "?":
-               # If we're not in a function (i.e. we get "?") then we're
-               # not using the step engine and thus no next step is
-               # necessary
-               job.next_step_prepend(this_functions_name) 
-
-if tries <= ITERATIONS:
-       job.reboot()
diff --git a/client/samples/test_add_kernel b/client/samples/test_add_kernel
deleted file mode 100644
index e6cae50..0000000
--- a/client/samples/test_add_kernel
+++ /dev/null
@@ -1,19 +0,0 @@
-print "TEST: initing kernel"
-testkernel = job.kernel('/usr/local/src/linux-2.6.14.tar.bz2') # '2.6.14'
-testkernel.patch('/usr/local/src/patch-2.6.14-git6.bz2')
-testkernel.config('http://ftp.kernel.org/pub/linux/kernel/people/mbligh/config/config.up')
-
-print "TEST: building kernel"
-testkernel.build()
-
-print "TEST: installing kernel"
-testkernel.install('autotest')
-
-print "TEST: adding kernel to bootloader"
-testkernel.add_to_bootloader('autotest') # using default boot args 
(/proc/cmdline)
-
-print "TEST: listing bootloader entries"
-job.bootloader.list_titles()
-
-print "TEST: initing kernbench"
-job.run_test('kernbench', iterations=2, threads=5)
diff --git a/client/samples/test_install b/client/samples/test_install
deleted file mode 100644
index ac50986..0000000
--- a/client/samples/test_install
+++ /dev/null
@@ -1,7 +0,0 @@
-print "TEST: initing kernel"
-testkernel = job.kernel('/usr/local/autotest/tmp2/build/build')
-print "TEST: installing kernel"
-testkernel.install()
-# print "TEST: booting system"
-# system.boot()          # does autotest by default
-
diff --git a/client/samples/test_job b/client/samples/test_job
deleted file mode 100644
index 3725cb9..0000000
--- a/client/samples/test_job
+++ /dev/null
@@ -1,18 +0,0 @@
-def step_init():
-        job.next_step([step_test])
-
-       print "TEST: initing kernel"
-       testkernel = job.kernel('2.6.18')
-       testkernel.config('http://mbligh.org/config/opteron2')
-
-       print "TEST: building kernel"
-       testkernel.build()
-
-       print "TEST: booting system"
-       testkernel.boot()          # does autotest by default
-
-def step_test():
-       print "TEST: sleeptest"
-        job.run_test('sleeptest', seconds=10)
-       print "TEST: kernbench"
-        job.run_test('kernbench')
diff --git a/client/samples/test_xenbuild b/client/samples/test_xenbuild
deleted file mode 100644
index 2a9dbcf..0000000
--- a/client/samples/test_xenbuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# this is a sample job to build xen and kernel with xen patches.
-# The xen unstable tarball comes with scripts that will automatically
-# patch a linux kernel, however, in some cases, PPC for example, the 
-# kernel is built from a seperate source.  The xen class supports 
-# defining your own kernel job, and handing that to the xen job.  If 
-# no kernel job is specified, it will create one using the kernel source
-# that the xen tarball uses.
-xensrc = 
'http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-unstable-src.tgz'
-
-#
-# uncomment the section below if you want to specify your own kernel job
-# for the xen build
-#
-# ------ start uncomment ------
-#print "TEST: initing kernel"
-#testkernel = job.kernel('/usr/local/src/linux-2.6.18.tar.bz2') # 2.4.18
-#testkernel.config('http://mbligh.org/config/opteron2')
-#print "TEST: initing xen"
-#testxen = job.xen(xensrc, kjob = testkernel)
-# ------ end uncomment ------
-
-# build xen using default xen kernel
-# comment the next two lines out if you are using the above custom
-# kernel job
-
-print "TEST: initing xen"
-testxen = job.xen(xensrc)
-
-print "TEST: building xen"
-testxen.build()
-
-print "TEST: installing xen"
-# using a dir in tmp as xen install needs root perms 
-# 
-testxen.install(tag='autotest', prefix='/tmp/xen')
-
-# uncomment if you run as root and want to install the xen build
-# testxen.boot()
-- 
1.7.2.3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to