[elbe-devel] [PATCH 24/25] test/tests: remove unused tests
Manuel Traut
manut at linutronix.de
Mon Dec 11 10:11:18 CET 2017
the scripting and unittests were some proof of concept that have been
never used.
add a short description of the use-case for updated.py test
Signed-off-by: Manuel Traut <manut at linutronix.de>
---
test/README | 301 +------------------------------------------------
test/modify_rfs.py | 37 ------
test/run-one-arch.sh | 22 ----
test/run-test.sh | 11 --
test/testdeb.sh | 19 ----
tests/README | 17 ---
tests/__init__.py | 1 -
tests/elbetest.py | 47 --------
tests/initvm_create.py | 42 -------
tests/initvmtests.py | 83 --------------
10 files changed, 5 insertions(+), 575 deletions(-)
delete mode 100644 test/modify_rfs.py
delete mode 100755 test/run-one-arch.sh
delete mode 100755 test/run-test.sh
delete mode 100755 test/testdeb.sh
delete mode 100644 tests/README
delete mode 100644 tests/__init__.py
delete mode 100644 tests/elbetest.py
delete mode 100644 tests/initvm_create.py
delete mode 100644 tests/initvmtests.py
diff --git a/test/README b/test/README
index 67fb8a3f..7149b257 100644
--- a/test/README
+++ b/test/README
@@ -1,297 +1,6 @@
-ELBE with update support
-========================
-Manuel Traut <manut at linutronix.de>
-v1, 20140313
+TESTS
+=====
-Files
------
-
-elbe-test.tbz
-~~~~~~~~~~~~~
-Debian Repository including the current development version of ELBE. Never use
-this prerelease to generate rootfilesystems for productive use!
-
-Extract the contents of this archive, so that a debian mirror is reachable on
-the localhost webserver:
-
-------------------------------------------------------------------------------
-host-pc:~/# sudo tar xjf elbe-test -C /var/www/html
-------------------------------------------------------------------------------
-
-'http://localhost/elbe-test' in a webbrowser needs to show:
-
-------------------------------------------------------------------------------
-Index of /elbe-test
-Name Last modified Size Description
-Parent Directory -
-[DIR] conf/ 2014-03-12 13:30 -
-[DIR] db/ 2014-03-12 13:30 -
-[DIR] dists/ 2014-03-12 13:30 -
-[DIR] pool/ 2014-03-12 13:30 -
-Apache/2.4.7 (Debian) Server at localhost Port 80
-------------------------------------------------------------------------------
-
-
-elbe-0.7.0-beta1.tar.gz
-~~~~~~~~~~~~~~~~~~~~~~~
-
-This archive contains the current sourcetree of the development version of ELBE.
-It can be used on the test machine to get acess to the test scripts, examples
-and to create an initial development environment.
-
-It can be extracted to any directory:
-
-------------------------------------------------------------------------------
-host-pc:~/# tar xzf elbe-0.7.0-beta1.tar.gz
-------------------------------------------------------------------------------
-
-create a ELBE buildmachine
---------------------------
-
-create a VM that hosts ELBE development (webinterface, rootfilesystems, ..)
-
-------------------------------------------------------------------------------
-host-pc:~/elbe-0.7.0-beta1# ./elbe init examples/elbe-init.xml --directory=../elbe-init
-host-pc:~/elbe-0.7.0-beta1# cd ../elbe-init
-host-pc:~/elbe-init# make
-host-pc:~/elbe-init# make run-con
-
-Debian GNU/Linux 7 elbe-daemon ttyS0
-
-elbe-daemon login: root
-Password: root
-root at elbe-daemon:~#
-------------------------------------------------------------------------------
-
-build a ELBE project
---------------------
-
-Now an initial target image will be created inside the VM. The buildchroot
-command will block for several minutes without any output.
-
-Take care that the elbe-updated is in the pkg list for the traget!
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~# scp local at 10.0.2.2:~/projects/elbe/elbe/examples/beaglebone-black.xml .
-local at 10.0.2.2's password:
-beaglebone-black.xml 100% 403KB 402.6KB/s 00:00
-root at elbe-daemon:~# elbe buildchroot -t beagle -o beagle.log -n beagle --skip-cdrom beaglebone-black.xml
-------------------------------------------------------------------------------
-
-The elbe project is now available in /root/beagle
-
-generate an update file
------------------------
-
-To add or update some packages modify the python script:
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~# cd beagle
-root at elbe-daemon:~/beagle# scp local at 10.0.2.2:~/projects/elbe/elbe/test/modify_rfs.py .
-local at 10.0.2.2's password:
-modify_rfs.py 100% 744 0.7KB/s 00:00
-root at elbe-daemon:~/beagle# python modify_rfs.py
-------------------------------------------------------------------------------
-
-Increment the version number in the source.xml file.
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~# vi source.xml
-------------------------------------------------------------------------------
-
-Then generate an update file.
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~/beagle# elbe gen_update -t . -n beagle source.xml
-root at elbe-daemon:~/beagle# ls -lh *.upd
--rw-r--r-- 1 root root 18M Mar 12 16:10 beaglebone-black_2.0.upd
-------------------------------------------------------------------------------
-
-Optional sign the update file (note gpg needs to be configured)
-It is useful to install haveged to increase the entrophy in the VM
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~/beagle# apt-get install pgp haveged
-root at elbe-daemon:~/beagle# gpg --gen-key
-...
-root at elbe-daemon:~/beagle# gpg --list-keys
-...
-pub 2048R/7C8F7060 2014-03-12
-...
-root at elbe-daemon:~/beagle# elbe sign beaglebone-black_2.0.upd 7C8F7060
-Signed file written to: beaglebone-black_2.0.upd.gpg
-------------------------------------------------------------------------------
-
-Copy the update files to the host pc:
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~/beagle# scp beagle*upd* local at 10.0.2.2:/tmp
-local at 10.0.2.2's password:
-beaglebone-black_2.0.upd 100% 17MB 16.5MB/s 00:00
-beaglebone-black_2.0.upd.gpg 100% 17MB 16.5MB/s 00:01
-------------------------------------------------------------------------------
-
-
-start the target system (in qemu)
----------------------------------
-
-To simplify testing no real target hw is used. Instead we currently use qemu
-to boot our beaglebone-black image.
-
-First the necessary files are copied from the VM to the host pc:
-
-------------------------------------------------------------------------------
-root at elbe-daemon:~/beagle# scp chroot/boot/*versatile* local at 10.0.2.2:/tmp
-local at 10.0.2.2's password:
-config-3.2.0-4-versatile 100% 88KB 87.6KB/s 00:00
-initrd.img-3.2.0-4-versatile 100% 7373KB 7.2MB/s 00:01
-System.map-3.2.0-4-versatile 100% 1100KB 1.1MB/s 00:00
-vmlinuz-3.2.0-4-versatile 100% 1383KB 1.4MB/s 00:00
-root at elbe-daemon:~/beagle# scp sdcard.img local at 10.0.2.2:/tmp
-local at 10.0.2.2's password:
-sdcard.img 48% 916MB 41.1MB/s 00:23 ETA
-------------------------------------------------------------------------------
-
-Then the qemu-system-arm is started on the host-pc:
-
-------------------------------------------------------------------------------
-local at host-pc:/tmp# qemu-system-arm -M versatilepb\
- -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile\
- -net nic,vlan=1,model=smc91c111,macaddr="ba:26:80:5a:c1:4c" -net user,vlan=1\
- -redir tcp:6022::22 -redir tcp:8088::8088\
- -hda sdcard.img -append "root=/dev/sda2"
-------------------------------------------------------------------------------
-
-(to login use 'root' with the password 'foo')
-
-The elbe-updated should be startet automatically. The SOAP interface should be
-reachable from the host-pc. A quick check is to retrieve the WSDL Interface
-description with a browser: "http://localhost:8088/?wsdl"
-
-------------------------------------------------------------------------------
-<definitions targetNamespace="elbepack.commands.updated.UpdateService"
-name="UpdateService"><types><schema
-targetNamespace="elbepack.commands.updated.UpdateService"><xs:complexType
-name="list_snapshots"><xs:sequence/></xs:complexType>
-...
-------------------------------------------------------------------------------
-
-
-apply an update file
---------------------
-
-To monitor the update progress the 'updated.py' test script may be used:
-
-------------------------------------------------------------------------------
-host-pc:~/elbe/test# ./updated.py --listen=10.0.2.2 2> /dev/null
-monitor ready :8087
-connection established
-select snapshot:
- [0] base_version
-%
-------------------------------------------------------------------------------
-
-Now copy an update file to the monitored directory:
-
-------------------------------------------------------------------------------
-host-pc:~/# scp -P 6022 beaglebone-black_2.0.upd.gpg root at localhost:/var/cache/elbe/updates/
-root at localhost's password: foo
-beaglebone-black_2.0.upd.gpg 100% 17MB 2.8MB/s 00:06
-------------------------------------------------------------------------------
-
-Due to a bug in the gpg checker, the upd file is always applied, even if
-the signature is unknown.
-
-If the file without the gpg ending will be uploaded, nothing will happen.
-This behaviour can be changed, if '--nosign' is added to the 'DAEMON_ARGS' in
-'/etc/init.d/elbe-updated'. The daemon needs to be restarted by
-'/etc/init.d/elbe-updated restart' that the change takes effect.
-
-The update progress can be monitored in the updated.py test script:
-
-------------------------------------------------------------------------------
-monitor ready :8087
-connection established
-select snapshot:
- [0] base_version
-% updating.. /var/cache/elbe/updates/beaglebone-black_2.0.upd
-preparing update: /var/cache/elbe/beaglebone-black_2.0/
-(1/3) updating package cache ...
-(1/3) Ign file: wheezy Release.gpg
-(1/3) Get:1 file: wheezy Release [932 B]
-(1/3) Ign file: wheezy/main Translation-en
-(2/3) calculating packages to install/remove ...
-(2/3) 10% - 24/248
-(2/3) 20% - 48/248
-(2/3) 30% - 72/248
-(2/3) 40% - 96/248
-(2/3) 50% - 120/248
-(2/3) 60% - 144/248
-(2/3) 70% - 168/248
-(2/3) 80% - 192/248
-(2/3) 90% - 216/248
-(2/3) 100% - 240/248
-(3/3) applying snapshot ...
-(3/3) 0.0% Running dpkg
-(3/3) 0.0% Installing libpcre3
-(3/3) 0.0% Installing libglib2.0-0
-(3/3) 0.0% Installing libatk1.0-data
-(3/3) 0.0% Preparing libatk1.0-data
-(3/3) 0.327869% Unpacking libatk1.0-data
-(3/3) 0.655738% Preparing to configure libatk1.0-data
-(3/3) 0.983607% Installing libatk1.0-0
-...
-(3/3) 20.0% Configuring libvorbisenc2
-(3/3) 20.0% Configuring libsndfile1
-(3/3) 20.0% Configuring quickplot
-(3/3) 20.0% Configuring quickplot
-(3/3) 20.3279% Installed quickplot
-update done: /var/cache/elbe/beaglebone-black_2.0/
-------------------------------------------------------------------------------
-
-select a specific update state
-------------------------------
-
-Use the updated.py test script to switch the target to a specific update state:
-
-Enter the number of the snapshot that should be applied.
-Any other input will terminate the testscript.
-
-------------------------------------------------------------------------------
-host-pc:~/elbe/test# ./updated.py --listen=10.0.2.2 2> /dev/null
-monitor ready :8087
-connection established
-select snapshot:
- [0] base_version
- [1] beaglebone-black_2.0
-% 0
-(1/3) updating package cache ...
-(1/3) Ign file: wheezy Release.gpg
-(1/3) Get:1 file: wheezy Release [932 B]
-(1/3) Ign file: wheezy/main Translation-en
-(2/3) calculating packages to install/remove ...
-(2/3) 10% - 24/248
-(2/3) 20% - 48/248
-(2/3) 30% - 72/248
-(2/3) 40% - 96/248
-(2/3) 50% - 120/248
-(2/3) 60% - 144/248
-(2/3) 70% - 168/248
-(2/3) 80% - 192/248
-(2/3) 90% - 216/248
-(2/3) 100% - 240/248
-(3/3) applying snapshot ...
-(3/3) 0.0% Running dpkg
-(3/3) 0.0% Removing quickplot
-...
-(3/3) 0.0% Preparing to completely remove quickplot
-(3/3) 0.819672% Completely removing quickplot
-(3/3) 0.819672% Completely removed quickplot
-(3/3) 1.63934% Removing libgtk-3-0
-(3/3) 1.63934% Completely removing libgtk-3-0
-(3/3) 18.8525% Completely removed ttf-dejavu-core
-(3/3) 19.6721% Removing ucf
-(3/3) 19.6721% Preparing to completely remove ucf
-(3/3) 20.4918% Completely removing ucf
-host-pc:~/elbe/test#
-------------------------------------------------------------------------------
+updated
+-------
+is a simple soap client for updated to test rollback of updates
diff --git a/test/modify_rfs.py b/test/modify_rfs.py
deleted file mode 100644
index d94121d3..00000000
--- a/test/modify_rfs.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from __future__ import print_function
-
-from elbepack import rfs
-from elbepack import elbexml
-from elbepack import filesystem
-from elbepack import asciidoclog
-
-import os
-import time
-
-class AsyncStatus:
- def __init__ (self):
- pass
- def status (self, msg):
- print("current status: " + msg)
-
-xml = elbexml.ElbeXML('source.xml')
-log = asciidoclog.ASCIIDocLog( "update.log" )
-br = rfs.BuildEnv(xml, log, 'chroot')
-status = AsyncStatus ()
-
-from elbepack.rpcaptcache import get_rpcaptcache
-
-# Use "with br" to mount the necessary bind mounts
-with br:
- cc = get_rpcaptcache(br.rfs, "aptcache.log", "armel", notifier=status)
- print("SECTIONS: ", cc.get_sections())
- time.sleep (2)
- print("SHELLS: ", cc.get_pkglist('shells'))
- time.sleep (2)
- print("QUICKPLOT: ", cc.get_dependencies('quickplot'))
- time.sleep (2)
- cc.mark_install('quickplot','2')
- cc.commit()
- #cc.mark_delete('quickplot','2')
- #cc.commit()
-
diff --git a/test/run-one-arch.sh b/test/run-one-arch.sh
deleted file mode 100755
index c3b04ee1..00000000
--- a/test/run-one-arch.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-DIR=$1
-ELBE=/home/torbenh/elbe/elbe/elbe
-HTTP_PROXY=http://192.168.0.1:3142
-
-mkdir -p $DIR
-rm -rf $DIR/netinst
-
-$ELBE create --directory $DIR/netinst --proxy $HTTP_PROXY $2
-cd $DIR/netinst
-/usr/bin/time -o $DIR/netinst.time make
-
-rm -rf $DIR/cdrominst
-cp $DIR/netinst/source.xml $DIR
-$ELBE setcdrom $DIR/source.xml $DIR/netinst/install.iso
-
-$ELBE create --directory $DIR/cdrominst $DIR/source.xml
-cd $DIR/cdrominst
-/usr/bin/time -o $DIR/cdrominst.time make
-
-sleep 10
diff --git a/test/run-test.sh b/test/run-test.sh
deleted file mode 100755
index f196f807..00000000
--- a/test/run-test.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-SCRATCH_DIR=/media/x1/torbenh/elbetest02
-
-mkdir -p $SCRATCH_DIR
-
-for ex in examples/*.xml; do
- screen test/run-one-arch.sh $SCRATCH_DIR/`basename $ex .xml` $ex;
-done
-
-
diff --git a/test/testdeb.sh b/test/testdeb.sh
deleted file mode 100755
index cd599dd7..00000000
--- a/test/testdeb.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-FILES=`find elbepack | grep -v .pyc$`
-MISSING=''
-
-for f in $FILES; do
- MISSING+=`grep -r $f debian/*.install > /dev/null || echo "$f ";`
-done
-
-if [ "$MISSING" == "" ]; then
- exit 0
-fi
-
-echo add the following files to debian/*.install:
-for m in $MISSING; do
- echo $m
-done
-
-exit 1
diff --git a/tests/README b/tests/README
deleted file mode 100644
index 7f3c7686..00000000
--- a/tests/README
+++ /dev/null
@@ -1,17 +0,0 @@
-
-First tests using nosetests
----------------------------
-
-how to run ?
-~~~~~~~~~~~~
-
-$ export ELBE_TEST_DIR=/some/path/where/initvms/might/reside
-$ nosetests -w tests/ --all-modules -v
-
-
-what is tested ?
-~~~~~~~~~~~~~~~~
-
-- uses elbe validate to validate all example files
-- uses elbe init to build examples starting with "elbe-init"
-
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index 8b137891..00000000
--- a/tests/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/tests/elbetest.py b/tests/elbetest.py
deleted file mode 100644
index 761cb657..00000000
--- a/tests/elbetest.py
+++ /dev/null
@@ -1,47 +0,0 @@
-
-import elbepack
-import os
-import sys
-import shutil
-
-from elbepack.directories import init_directories
-from elbepack.shellhelper import system
-
-exe_path = None
-
-def setUpModule():
- global exe_path
- # Properly initialise directories plug
- mod_dir = os.path.dirname (__file__)
- main_dir, _ = os.path.split( mod_dir )
- exe_path = os.path.join( main_dir, "elbe" )
-
- init_directories (exe_path)
-
-def validate_example (xml_name):
- system ("%s validate %s" % (exe_path, xml_name))
-
-def test_example_validation ():
- from elbepack.directories import examples_dir
- for e in os.listdir (examples_dir):
- xml_name = os.path.join (examples_dir, e)
- yield validate_example, xml_name
-
-def init_example (xml_name):
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "init_test")
-
- try:
- system ('%s init --directory "%s" %s' % (exe_path, dname, xml_name))
- finally:
- shutil.rmtree (dname)
-
-def test_elbe_init ():
- from elbepack.directories import examples_dir
- for e in os.listdir (examples_dir):
- xml_name = os.path.join (examples_dir, e)
- if e.startswith( "elbe-init" ):
- yield init_example, xml_name
-
diff --git a/tests/initvm_create.py b/tests/initvm_create.py
deleted file mode 100644
index f4b38b2a..00000000
--- a/tests/initvm_create.py
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-import elbepack
-import os
-import sys
-import shutil
-from time import sleep
-
-from elbepack.directories import init_directories
-from elbepack.shellhelper import system
-
-exe_path = None
-
-def test_initvm():
- try:
- global exe_path
- # Properly initialise directories plug
- mod_dir = os.path.dirname (__file__)
- main_dir, _ = os.path.split( mod_dir )
- exe_path = os.path.join( main_dir, "elbe" )
-
- init_directories (exe_path)
-
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "initvm_test")
-
- from elbepack.directories import examples_dir
- xml_name = os.path.join (examples_dir, "elbe-init-with-ssh.xml")
- system ('%s initvm create --devel --directory "%s" %s' % (exe_path, dname, xml_name))
- except:
- system ("%s control shutdown_initvm" % (exe_path), allow_fail=True)
- sleep (10)
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "initvm_test")
- shutil.rmtree (dname)
- raise
-
-
diff --git a/tests/initvmtests.py b/tests/initvmtests.py
deleted file mode 100644
index bddbbaf4..00000000
--- a/tests/initvmtests.py
+++ /dev/null
@@ -1,83 +0,0 @@
-
-import elbepack
-import os
-import sys
-import shutil
-from time import sleep
-
-from elbepack.directories import init_directories
-from elbepack.shellhelper import system
-
-exe_path = None
-
-def setup():
- try:
- global exe_path
- # Properly initialise directories plug
- mod_dir = os.path.dirname (__file__)
- main_dir, _ = os.path.split( mod_dir )
- exe_path = os.path.join( main_dir, "elbe" )
-
- init_directories (exe_path)
-
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "initvm_test")
-
- from elbepack.directories import examples_dir
- xml_name = os.path.join (examples_dir, "elbe-init-with-ssh.xml")
- system ('%s initvm create --devel --directory "%s"' % (exe_path, dname))
- except:
- teardown ()
- raise
-
-def teardown():
-
- system ("%s control shutdown_initvm" % (exe_path), allow_fail=True)
- sleep (10)
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "initvm_test")
- shutil.rmtree (dname)
-
-
-def test_submit ():
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "initvm_output")
- system ('mkdir "%s"' % dname)
- system ('mkdir "%s02"' % dname)
-
- try:
- from elbepack.directories import examples_dir
- xml_name = os.path.join (examples_dir, "rescue.xml")
-
- system ('%s initvm submit --build-bin --output "%s" "%s"' % (exe_path, dname, xml_name))
-
- # Now submit the iso image
- system ('%s initvm submit --output "%s02" "%s"' % (exe_path, dname, os.path.join (dname, "bin-cdrom.iso")))
- finally:
- shutil.rmtree (dname)
- shutil.rmtree (dname+"02")
-
-def test_srcbuild ():
- tmpdir = os.getenv( "ELBE_TEST_DIR" )
- assert tmpdir is not None
-
- dname = os.path.join(tmpdir, "initvm_output")
- system ('mkdir "%s"' % dname)
- system ('mkdir "%s02"' % dname)
-
- try:
- from elbepack.directories import examples_dir
- xml_name = os.path.join (examples_dir, "rescue.xml")
-
- system ('%s initvm submit --build-source --output "%s" "%s"' % (exe_path, dname, xml_name))
- finally:
- shutil.rmtree (dname)
- shutil.rmtree (dname+"02")
-
-
--
2.15.1
More information about the elbe-devel
mailing list