diff options
author | Michael E Brown <michael_e_brown@dell.com> | 2007-12-10 11:04:20 -0600 |
---|---|---|
committer | Michael E Brown <michael_e_brown@dell.com> | 2007-12-10 11:04:20 -0600 |
commit | ce6e26a58c56b7b8e0b770318a6a1469e6937e66 (patch) | |
tree | 9237400fa9a3f35d4fe4e3543059b0d3978f8de9 | |
parent | aada35a1281981a361cce99f923f467ddabbeb76 (diff) | |
download | mock-ce6e26a58c56b7b8e0b770318a6a1469e6937e66.tar.gz mock-ce6e26a58c56b7b8e0b770318a6a1469e6937e66.tar.xz mock-ce6e26a58c56b7b8e0b770318a6a1469e6937e66.zip |
add --orphanskill mode. requested by mbonnet for koji.
-rwxr-xr-x | docs/releasetests.sh | 17 | ||||
-rwxr-xr-x | py/mock.py | 13 |
2 files changed, 25 insertions, 5 deletions
diff --git a/docs/releasetests.sh b/docs/releasetests.sh index 8924042..693d12c 100755 --- a/docs/releasetests.sh +++ b/docs/releasetests.sh @@ -61,7 +61,7 @@ if [ ! -e mock-unit-test/mock-*.x86_64.rpm ]; then fi # -# Test orphanskill feature +# Test orphanskill feature (std) # if pgrep daemontest; then echo "Exiting because there is already a daemontest running." @@ -76,6 +76,21 @@ if pgrep daemontest; then fi # +# Test orphanskill feature (explicit) +# +time $MOCKCMD --offline --init +cp docs/daemontest $CHROOT/tmp +echo -e "#!/bin/sh\n/tmp/daemontest\nsleep 60\n" >> $CHROOT/tmp/try +$MOCKCMD --offline --chroot -- /tmp/try & +kill -9 $! +$MOCKCMD --offline --orphanskill +if pgrep daemontest; then + echo "Daemontest FAILED. found a daemontest process running after exit." + exit 1 +fi + + +# # test init/clean # time $MOCKCMD --offline --clean @@ -83,6 +83,9 @@ def command_parse(config_opts): parser.add_option("--install", action="store_const", const="install", dest="mode", help="install packages using yum") + parser.add_option("--orphanskill", action="store_const", const="orphanskill", + dest="mode", + help="Kill all processes using specified buildroot.") parser.add_option("-r", action="store", type="string", dest="chroot", help="chroot name/config file name default: %default", @@ -449,8 +452,6 @@ def main(ret): ret["chroot"] = chroot ret["config_opts"] = config_opts os.umask(002) - if options.mode not in ('chroot', 'shell', 'install', 'installdeps') and config_opts['clean']: - chroot.clean() # New namespace starting from here try: @@ -459,11 +460,12 @@ def main(ret): log.info("Namespace unshare failed.") if options.mode == 'init': + if config_opts['clean']: + chroot.clean() chroot.init() elif options.mode == 'clean': - if chroot.state() != "clean": - chroot.clean() + chroot.clean() elif options.mode in ('chroot', 'shell'): chroot.tryLockBuildRoot() @@ -503,6 +505,9 @@ def main(ret): elif options.mode == 'rebuild': do_rebuild(config_opts, chroot, args) + elif options.mode == 'orphanskill': + mock.util.orphansKill(chroot.rootdir) + if __name__ == '__main__': # fix for python 2.4 logging module bug: |