-mic cr fs --arch=armv7hl --config=customer.conf --pkgmgr=zypp --outdir=outdir10 --release=XXX --logfile=logfile9 --local-pkgs-path=package_armv7hl --record-pkgs=name
+mic cr fs --arch=armv7hl --config=customer.conf --pkgmgr=zypp --outdir=outdir10 --release=XXX --logfile=logfile9 --record-pkgs=name
-mic cr fs --arch=armv7hl --pkgmgr=yum --include-src --logfile=logfile1 --local-pkgs-path=package_armv7hl
+mic cr fs --arch=armv7hl --pkgmgr=yum --include-src --logfile=logfile1
-mic cr loop --taring-to=XXX --local-pkgs-path=package_mixed --pkgmgr=zypp
+mic cr loop --taring-to=XXX --pkgmgr=zypp
-mic cr raw --arch=armv7hl --pkgmgr=yum --arch=armv7hl --local-pkgs-path=package_mixed
+mic cr raw --arch=armv7hl --pkgmgr=yum --arch=armv7hl
--- /dev/null
+chroot (ch): chroot into an image
+
+Usage:
+ mic chroot <imagefile>
+
+Options:
+ -h, --help show this help message and exit
+ -s SAVETO, --saveto=SAVETO
+ Save the unpacked image to specified dir
\ No newline at end of file
--- /dev/null
+chroot (ch): chroot into an image
+
+Usage:
+ mic chroot <imagefile>
+
+Options:
+ -h, --help show this help message and exit
+ -s SAVETO, --saveto=SAVETO
+ Save the unpacked image to specified dir
\ No newline at end of file
--- /dev/null
+mic ch --help
--- /dev/null
+chroot (ch): chroot into an image
+
+Usage:
+ mic chroot <imagefile>
+
+Options:
+ -h, --help show this help message and exit
+ -s SAVETO, --saveto=SAVETO
+ Save the unpacked image to specified dir
\ No newline at end of file
--- /dev/null
+mic chroot -h
--- /dev/null
+chroot (ch): chroot into an image
+
+Usage:
+ mic chroot <imagefile>
+
+Options:
+ -h, --help show this help message and exit
+ -s SAVETO, --saveto=SAVETO
+ Save the unpacked image to specified dir
\ No newline at end of file
--- /dev/null
+mic chroot --help
--- /dev/null
+convert (cv): convert image format
+
+Usage:
+ mic convert <imagefile> <destformat>
+
+Options:
+ -h, --help show this help message and exit
+ -S, --shell Launch shell before packaging the converted image
\ No newline at end of file
--- /dev/null
+mic convert -h
--- /dev/null
+convert (cv): convert image format
+
+Usage:
+ mic convert <imagefile> <destformat>
+
+Options:
+ -h, --help show this help message and exit
+ -S, --shell Launch shell before packaging the converted image
\ No newline at end of file
--- /dev/null
+mic convert --help
--- /dev/null
+fs: create fs image
+
+Usage:
+ mic create(cr) fs <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --include-src Generate a image with source rpms included
\ No newline at end of file
--- /dev/null
+mic cr fs --h
--- /dev/null
+fs: create fs image
+
+Usage:
+ mic create(cr) fs <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --include-src Generate a image with source rpms included
\ No newline at end of file
--- /dev/null
+mic cr fs --help
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic cr help
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic cr --help
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+livecd: create livecd image
+
+Usage:
+ mic create(cr) livecd <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic cr livecd -h
--- /dev/null
+livecd: create livecd image
+
+Usage:
+ mic create(cr) livecd <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic cr livecd --help
--- /dev/null
+liveusb: create liveusb image
+
+Usage:
+ mic create(cr) liveusb <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic cr liveusb --h
--- /dev/null
+liveusb: create liveusb image
+
+Usage:
+ mic create(cr) liveusb <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic cr liveusb --help
--- /dev/null
+loop: create loop image
+
+Usage:
+ mic create(cr) loop <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --taring-to=TARING_TO
+ Specify the filename for packaging all loop images
+ into a single tarball
\ No newline at end of file
--- /dev/null
+mic cr loop -h
--- /dev/null
+loop: create loop image
+
+Usage:
+ mic create(cr) loop <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --taring-to=TARING_TO
+ Specify the filename for packaging all loop images
+ into a single tarball
\ No newline at end of file
--- /dev/null
+mic cr loop --help
--- /dev/null
+raw: create raw image
+
+Usage:
+ mic create(cr) raw <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic cr raw -h
--- /dev/null
+raw: create raw image
+
+Usage:
+ mic create(cr) raw <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic cr raw --help
--- /dev/null
+fs: create fs image
+
+Usage:
+ mic create(cr) fs <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --include-src Generate a image with source rpms included
\ No newline at end of file
--- /dev/null
+mic create fs --h
--- /dev/null
+fs: create fs image
+
+Usage:
+ mic create(cr) fs <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --include-src Generate a image with source rpms included
\ No newline at end of file
--- /dev/null
+mic create fs --help
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic create -h
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic create help
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic create --help
--- /dev/null
+mic create(cr): create an image
+
+Usage:
+ mic create(cr) SUBCOMMAND <ksfile> [OPTS]
+
+Commands:
+ fs create fs image
+ help (?) give detailed help on a specific sub-command
+ livecd create livecd image
+ liveusb create liveusb image
+ loop create loop image
+ raw create raw image
+
+Options:
+ -h, --help show this help message and exit
+ --logfile=LOGFILE Path of logfile
+ -c CONFIG, --config=CONFIG
+ Specify config file for mic
+ -k CACHEDIR, --cachedir=CACHEDIR
+ Cache directory to store the downloaded
+ -o OUTDIR, --outdir=OUTDIR
+ Output directory
+ -A ARCH, --arch=ARCH
+ Specify repo architecture
+ --release=RID Generate a release of RID with all necessary files,
+ when @BUILD_ID@ is contained in kickstart file, it
+ will be replaced by RID
+ --record-pkgs=RECORD_PKGS
+ Record the info of installed packages, multiple values
+ can be specified which joined by ",", valid values:
+ "name", "content", "license"
+ --pkgmgr=PKGMGR Specify backend package manager
+ --local-pkgs-path=LOCAL_PKGS_PATH
+ Path for local pkgs(rpms) to be installed
+ --runtime=RUNTIME Specify runtime mode, avaiable: bootstrap
+ --compress-disk-image=COMPRESS_DISK_IMAGE
+ Sets the disk image compression. NOTE: The available
+ values might depend on the used filesystem type.
+ --copy-kernel Copy kernel files from image /boot directory to the
+ image output directory.
\ No newline at end of file
--- /dev/null
+mic create ?
--- /dev/null
+livecd: create livecd image
+
+Usage:
+ mic create(cr) livecd <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic create livecd -h
--- /dev/null
+livecd: create livecd image
+
+Usage:
+ mic create(cr) livecd <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic create livecd --help
--- /dev/null
+liveusb: create liveusb image
+
+Usage:
+ mic create(cr) liveusb <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic create liveusb --h
--- /dev/null
+liveusb: create liveusb image
+
+Usage:
+ mic create(cr) liveusb <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic create liveusb --help
--- /dev/null
+loop: create loop image
+
+Usage:
+ mic create(cr) loop <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --taring-to=TARING_TO
+ Specify the filename for packaging all loop images
+ into a single tarball
\ No newline at end of file
--- /dev/null
+mic create loop -h
--- /dev/null
+loop: create loop image
+
+Usage:
+ mic create(cr) loop <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
+ --taring-to=TARING_TO
+ Specify the filename for packaging all loop images
+ into a single tarball
\ No newline at end of file
--- /dev/null
+mic create loop --help
--- /dev/null
+raw: create raw image
+
+Usage:
+ mic create(cr) raw <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic create raw -h
--- /dev/null
+raw: create raw image
+
+Usage:
+ mic create(cr) raw <ksfile> [OPTS]
+
+Options:
+ -h, --help show this help message and exit
\ No newline at end of file
--- /dev/null
+mic create raw --help
--- /dev/null
+convert (cv): convert image format
+
+Usage:
+ mic convert <imagefile> <destformat>
+
+Options:
+ -h, --help show this help message and exit
+ -S, --shell Launch shell before packaging the converted image
\ No newline at end of file
--- /dev/null
+convert (cv): convert image format
+
+Usage:
+ mic convert <imagefile> <destformat>
+
+Options:
+ -h, --help show this help message and exit
+ -S, --shell Launch shell before packaging the converted image
\ No newline at end of file
--- /dev/null
+mic cv --help
--- /dev/null
+Usage: mic SUBCOMMAND [OPTS] [ARGS...]
+
+mic Means the Image Creation tool
+Try 'mic help SUBCOMMAND' for help on a specific subcommand.
+
+Commands:
+ chroot (ch) chroot into an image
+ convert (cv) convert image format
+ create (cr) create an image
+ help (?) give detailed help on a specific sub-command
+
+global Options:
+ --version show program's version number and exit
+ -h, --help show this help message and exit
+ -d, --debug print debug message
+ -v, --verbose verbose information
\ No newline at end of file
--- /dev/null
+Usage: mic SUBCOMMAND [OPTS] [ARGS...]
+
+mic Means the Image Creation tool
+Try 'mic help SUBCOMMAND' for help on a specific subcommand.
+
+Commands:
+ chroot (ch) chroot into an image
+ convert (cv) convert image format
+ create (cr) create an image
+ help (?) give detailed help on a specific sub-command
+
+global Options:
+ --version show program's version number and exit
+ -h, --help show this help message and exit
+ -d, --debug print debug message
+ -v, --verbose verbose information
\ No newline at end of file
--- /dev/null
+mic --help
--- /dev/null
+Usage: mic SUBCOMMAND [OPTS] [ARGS...]
+
+mic Means the Image Creation tool
+Try 'mic help SUBCOMMAND' for help on a specific subcommand.
+
+Commands:
+ chroot (ch) chroot into an image
+ convert (cv) convert image format
+ create (cr) create an image
+ help (?) give detailed help on a specific sub-command
+
+global Options:
+ --version show program's version number and exit
+ -h, --help show this help message and exit
+ -d, --debug print debug message
+ -v, --verbose verbose information
\ No newline at end of file
-mic create livecd --pkgmgr=yum --local-pkgs-path=package_ia32
+mic create livecd --pkgmgr=yum
-mic create livecd --pkgmgr=zypp --local-pkgs-path=package_mixed
+mic create livecd --pkgmgr=zypp
-mic cr livecd --pkgmgr=yum --release=XXX --local-pkgs-path=package_ia32
+mic cr livecd --pkgmgr=yum --release=XXX
-mic cr liveusb --pkgmgr=yum --local-pkgs-path=package_mixed -o outdir5
+mic cr liveusb --pkgmgr=yum -o outdir5
-mic create liveusb --pkgmgr=zypp --local-pkgs-path=package_ia32
+mic create liveusb --pkgmgr=zypp
-mic cr livecd --pkgmgr=yum --release=XXX --local-pkgs-path=package_ia32
+mic cr livecd --pkgmgr=yum --release=XXX
-mic cr raw --pkgmgr=yum --outdir=outdir6 --release=XXX --logfile=logfile5 --local-pkgs-path=package_ia32 --record-pkgs=license
+mic cr raw --pkgmgr=yum --outdir=outdir6 --release=XXX --logfile=logfile5 --record-pkgs=license
--- /dev/null
+0.6
\ No newline at end of file
--- /dev/null
+mic --version
#!/usr/bin/python
-import os
+import os
import sys
import subprocess, re, shutil, glob
import gettext
shutil.copy(one, work_env)
for other in glob.glob(os.path.join(cases_dir, 'test-'+case, '*')):
shutil.copy(other, work_env)
-
+
def ImgCheck(work_env):
"""check image generate"""
genImage = False
def RunandCheck(object, work_env):
"""run mic-image-creator command and check something"""
- ret = False
-
+ ret = False
+
cwd = os.getcwd()
os.chdir(work_env)
os.system(PRESCRIPTS)
-
+
#set value of "expect"
expect = None
if "expect" in os.listdir(work_env):
exp = exp_f.read()
if len(exp) > 0:
expect = exp.strip()
+ exp_f.close()
#set cmdline
opt_f = open('options','r')
- args = opt_f.read().strip()+' test.ks'
-
+ mic_cmd = opt_f.read().strip()
+ if mic_cmd.find('-h')!=-1 or mic_cmd.find('help')!=-1 or mic_cmd.find('?')!=-1:
+ args = mic_cmd
+ else:
+ args = mic_cmd+' test.ks'
+
print args
- proc = subprocess.Popen(args,stdout = sys.stdout ,stderr=subprocess.PIPE,shell=True)
+ log = open('miclog','w')
+ proc = subprocess.Popen(args,stdout = log ,stderr=subprocess.PIPE,shell=True)
errorinfo = proc.communicate()[1]
+ log.close()
+
+ mic_cmd_msg = None
+ miclog_f = open('miclog','r')
+ miclog_tuple = miclog_f.read()
+ if len(miclog_tuple) > 0:
+ mic_cmd_msg = miclog_tuple.strip()
#check
if expect:
- if errorinfo.find(expect) != -1:#FIXME
+ if errorinfo.find(expect) != -1 or mic_cmd_msg.find(expect) != -1 :#FIXME
ret =True
else:
proc.wait()
ret = ImgCheck(work_env)
- os.system(POSTSCRIPTS)
+ os.system(POSTSCRIPTS)
os.chdir(cwd)
-
+
try:
object.assertTrue(ret)
except object.failureException:
- raise object.failureException(_("%s%s%s") %(COLOR_RED,errorinfo,COLOR_BLACK))
+ if expect:
+ ''' Used to update help expect info automaticlly.
+ path = object._testMethodName
+ path = path.replace('_','-',1)
+ os.unlink('%s/mic_cases/%s/expect' % (cwd,path))
+ fp = open('%s/mic_cases/%s/expect' % (cwd,path),'w')
+ fp.write(mic_cmd_msg)
+ fp.close()
+ '''
+ raise object.failureException(_("Expect and mic out msg are not constant\n%sExpect:%s\n\nMic out msg:%s%s") %(COLOR_RED,expect,mic_cmd_msg,COLOR_BLACK))
+ else:
+ raise object.failureException(_("%s%s%s") %(COLOR_RED,errorinfo,COLOR_BLACK))