I've snipped the parts which you said to ignore.. On Wed, May 08, 2013 at 04:52:42PM -0700, Dylan Baker wrote: [snip]
> Also, instead of using \ escapes, line up the quotation marks on the > left and python will magically concatenate the strings. I was just following what I saw in --tests. Maybe you want to fix that one too? I've removed this locally and added your r-b (which you gave me privately). I'll let it sit meanwhile a bit longer to see if anyone else has comments. Thanks for the review. [snip] > On Wed, May 8, 2013 at 3:15 PM, Ben Widawsky <[1][email protected]> > wrote: > > Some of us (ie. not just me) like to script piglit runs. As such > we've > all baked in versions of our own auto result directory naming, or as > an > alternative accidentally overwritten the results we've wanted.. To > make > things easier for people, add two new options under the -o > (overwrite) > flag. > [-o {yes,no,next}] > yes: default, and previous behavior. Just do it. > no: warn, and exit if you try to overwrite the results dir. > next: create a new results dir with an appended number. > For example, if one invokes: > > piglit-run.py -o next tests/igt.tests results/ppgtt-ctx > and results/ppgtt-ctx exists... > results would be written to results/ppgtt-ctx.1. > To keep the code relatively simple, it won't be smart if the user > specifies a number in their invocation. ie. if after doing the > above, > > piglit-run.py -o next tests/igt.tests results/ppgtt-ctx.1 > results/ppgtt-ctx.1.1 would be created. > CC: Kenneth Graunke <[2][email protected]> > Signed-off-by: Ben Widawsky <[3][email protected]> > --- > piglit-run.py | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > diff --git a/piglit-run.py b/piglit-run.py > index 6d6ec77..175ee56 100755 > --- a/piglit-run.py > +++ b/piglit-run.py > @@ -28,6 +28,7 @@ import sys, os > import time > import traceback > import json > +import re > sys.path.append(path.dirname(path.realpath(sys.argv[0]))) > import framework.core as core > @@ -72,6 +73,12 @@ def main(): > action = "append", > metavar = "<regex>", > help = "Exclude matching tests (can be > used more than once)") > + parser.add_argument("-o", "--overwrite", > + default = "yes", > + choices = ["yes", "no", "next"], > + help = "Results directory overwrite > options. " \ > + "\"next\" will create a new > directory name " \ > + "based on the old similarly names > ones") > # The new option going forward should be --no-concurrency, > but to > # maintain backwards compatability the --c, --concurrent > option should > @@ -149,6 +156,22 @@ def main(): > else: > profileFilename = args.testProfile > resultsDir = args.resultsPath > + if os.path.isdir(resultsDir): > + if args.overwrite == "no": > + sys.exit(resultsDir + " Already > exists, and overwrite was no") > + elif args.overwrite == "next": > + suffixes = [0] # If we found the > dir, we have at least 1 > + > + # Find the highest numbered results > dir > + pattern = > re.compile(os.path.basename(resultsDir) + "\.*(\d+)") > + parent = > os.path.abspath(os.path.join(resultsDir, os.pardir)) > + for file in os.listdir(parent): > + m = pattern.match(file) > + if m: > + > suffixes.append(m.group(1)) > + > + # Add 1 to the highest, and move > along > + resultsDir += "." + > str((int(max(suffixes))+1)) > # Pass arguments into Environment > env = core.Environment(concurrent=args.concurrency, > -- > 1.8.2.2 > _______________________________________________ > Piglit mailing list > [4][email protected] > [5]http://lists.freedesktop.org/mailman/listinfo/piglit > > References > > 1. mailto:[email protected] > 2. mailto:[email protected] > 3. mailto:[email protected] > 4. mailto:[email protected] > 5. http://lists.freedesktop.org/mailman/listinfo/piglit > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit -- Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
