Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: bdb5ba7ba5
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 37 lines (30 sloc) 1.209 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#!/usr/bin/env python

# if the testoutput directory isn't clear, archive it and clear it

import sys,os,re,logging,time,shutil,datetime
from optparse import OptionParser

def cmd(cmd):
    fd = os.popen(cmd)
    retval = fd.read()
    fd.close()
    return retval

if __name__ == "__main__":

    # parse two command line options
    parser = OptionParser()
    parser.add_option("-o", "--outputpath",
                      action="store", type="string", dest="outputpath",
                      help="path to JUnit results")
    parser.add_option("-a", "--archivepath",
                      action="store", type="string", dest="archivepath",
                      help="path to folder holding junit archive")
    (options, args) = parser.parse_args()

    outdir = os.path.abspath(options.outputpath)
    now = datetime.datetime.now().strftime("%y-%m-%d_%H-%M-%S")
    filename = "archive-%s.tgz" % (now)
    archive = os.path.join(options.archivepath, filename)
    if len(os.listdir(outdir)) > 0:
        # archive the contents of testout
        cmd("tar -czf %s %s" % (archive, outdir))
        shutil.rmtree(outdir)
        os.makedirs(outdir)
    if len(os.listdir(outdir)) > 0:
        sys.exit(-1)
Something went wrong with that request. Please try again.