Skip to content

Commit

Permalink
Make number of tests customizable through .tatt file.
Browse files Browse the repository at this point in the history
  • Loading branch information
tom111 committed Mar 11, 2011
1 parent d424b85 commit ff24215
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
9 changes: 9 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,12 @@ tatt -h

# ignoreprefix contains a list of use flag prefixes to be ignored
# ignoreprefix="elibc_","video_cards_","linguas_","kdeenablefinal","test","debug"

# You can customize the maximal number of rdeps to be tested as follows:
# rdeps=3

# You can customize the maximal number USE combis to be tested as follows:
# usecombis=3
# Note that All USE-flags on and all USE-flags off will always be tested.


4 changes: 4 additions & 0 deletions TODO.org
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ Global config object will be pushed around
* TODO Dependency resolution for the commit script
* TODO tinderbox lookup should be arch-specific
* TODO Potential duplicates in revdep sampling. try libpcre for an instance
* DONE Implement a shorter run for large scale stabilizations (make number of USE combis customizable)
CLOSED: [2011-03-11 Fri 13:22]
number of rdeps and use flags are now customizable
* TODO Implement an option to only write a commit script
2 changes: 2 additions & 0 deletions tatt/dot-tatt-spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ template-dir=string(default="/usr/share/tatt/templates/")
unmaskfile=string(default="/etc/portage/package.keywords/archtest")
arch=string(default="x86")
defaultopts=string(default="")
rdeps=integer(0,50,default=10)
usecombis=integer(0,64,default=12)
2 changes: 1 addition & 1 deletion tatt/scriptwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def writerdepscript(job, packlist, config):
# Populate the list of rdeps
rdeps = []
for p in packlist:
rdeps = rdeps + stablerdeps (p)
rdeps = rdeps + stablerdeps (p, config)
if len(rdeps) == 0:
print("No stable rdeps for " + job)
return
Expand Down
18 changes: 9 additions & 9 deletions tatt/tinderbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## Pass the config on to this function:

## Generate stable rdeps ###
def stablerdeps (package):
def stablerdeps (package, config):
"""
Find packages with stable versions which depend on atom
We query the tinderbox at http://tinderbox.dev.gentoo.org/misc/dindex/
Expand Down Expand Up @@ -61,14 +61,14 @@ def stablerdeps (package):
d[gP(s[0]).packageCatName()] = s[1]
outlist2 = [[k, d[k]] for k in list(d.keys())]
outlist = []
# outlist2 is set up at this point. To cut it down we sample randomly
# without replacement until the list is empty or we have 20.
# outlist2 is set up at this point. It contains all candidates. To cut it down we sample
# randomly without replacement until the list is empty or we have config['rdeps'] many.

# We are calling eix for each package to work around issues with --stable:
# What we should do with a future version of eix is to do this in a single run!
# Todo: Fork multiple eix instances
# What we should do with a future version of eix is to do this in a single run
# or fork multiple eix instances

while ((len (outlist2) > 0) and (len(outlist) < 20)):
while ((len (outlist2) > 0) and (len(outlist) < config['rdeps'])):
# Warning: sample returns a list, even if only one sample
[samp]=random.sample(outlist2, 1)
# Drop the one we selected
Expand All @@ -79,8 +79,8 @@ def stablerdeps (package):
if out == '': continue
else : outlist.append(samp)

if len(outlist) > 19:
print("More than 20 stable rdeps, sampled 20. \n")
if len(outlist) > config['rdeps']:
print("More than " + config['rdeps'] + " stable rdeps, took a sample. \n")
return outlist

#############################
13 changes: 9 additions & 4 deletions tatt/usecombis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import random
import re
import math
from subprocess import *

from .tool import unique
Expand All @@ -21,17 +22,21 @@ def findUseFlagCombis (package, config):
for i in config['ignoreprefix']:
uselist=[u for u in uselist if not re.match(i,u)]

if len(uselist) > 4:
# More than 4 use flags, generate 16 random strings and everything -, everything +
if config['usecombis'] == 0:
# Do only all and nothing:
swlist = [0,2**(len(uselist))-1]
# Test if we can exhaust all USE-combis by computing the binary logarithm.
elif len(uselist) > math.log(config['usecombis'],2):
# Generate a sample of USE combis
s = 2**(len (uselist))
random.seed()
swlist = [random.randint(0, s-1) for i in range (16)]
swlist = [random.randint(0, s-1) for i in range (config['usecombis'])]
swlist.append(0)
swlist.append(s-1)
swlist.sort()
swlist = unique(swlist)
else:
# 4 or less use flags. Generate all combinations
# Yes we can: generate all combinations
swlist = list(range(2**len(uselist)))

usecombis=[]
Expand Down

0 comments on commit ff24215

Please sign in to comment.