示例#1
0

class doExit(Exception):
    def __init__(self, value):
        self.value = value


isGit = os.environ["TEST_SEARCHER"] == "git"
print isGit
try:
    ancestryFilename = os.environ["TEST_ANCESTRY"]
    testDir = os.environ["TEST_DIR"]
    loc = int(os.environ["TEST_LOC"])

    f = file(ancestryFilename, "r")
    (identifiers, parents) = dagRead.read(f)
    f.close()
    N = len(parents)
    thisDag = dag.dag(parents, N)
    t = testDetector.detect(N, 1.0, thisDag, False, loc)

    numbers = {}
    for i in range(len(identifiers)):
        numbers[identifiers[i]] = i

    if isGit:
        os.system("git rev-parse HEAD >$TEST_DIR/__head__")
        where = open(testDir + "/__head__", "r").readline().strip()
        where = numbers[where]
    else:
        where = sys.argv[1]
示例#2
0
#    You should have received a copy of the GNU General Public License
#    along with BBChop.  If not, see <http://www.gnu.org/licenses/>.
import randomdag
import random
import dagRead


try:
    for test in range(100):
        N=random.randint(10,100)
        dagDef=randomdag.randomdagTxt(N)
        
        dagDefShuffled=dagDef
        random.shuffle(dagDefShuffled)
        
        (dagIds,dagParents)=dagRead.read(dagDefShuffled)
        
        
        dagCheck=dagDef
        for i in range(len(dagDef)):
            dagTerm=dagIds[i]
            for p in dagParents[i]:
                if p>i:
                    raise "invalidDag"
                dagTerm+=' '+dagIds[p]
            if dagTerm not in dagCheck:
                raise "missing term"
            dagCheck=[x for x in dagCheck if x!=dagTerm]
        print "test %d passed" %(test)
except:
    print "FAILED"
示例#3
0
文件: perfgit.py 项目: kbiondi/bbchop
ancFname =  testDir + "/anc.txt"
os.environ['TEST_ANCESTRY'] = ancFname


def sysc(cmd):
    print cmd,"->"
    os.system(cmd)

sysc("mkdir -p "+testDir)
os.environ["TEST_DIR"] = testDir


os.chdir(gitRepo)
os.system("$topdir/interfaces/git/git-bbchop-list "+failVer+" ^"+passVer+" >$TEST_ANCESTRY")
ancFile=open(ancFname,"r")
(identifiers,parents)=dagRead.read(ancFile)
N=len(parents)

gitcmd = "./git "

import pdb

def commonBefore(rev,searcher):
    os.environ['TEST_LOC']=str(rev)
    os.environ['TEST_SEARCHER']=searcher
    sysc("cp /dev/null $TEST_DIR/tries")
    
def commonAfter(where,rev):
        sysc('wc -l  $TEST_DIR/tries >$TEST_DIR/count')
        count=int(open(testDir+"/count","r").readline().split()[0])
        return (where==identifiers[rev],count)
示例#4
0
    def write(self, sep):
        pass

    def close(self):
        pass


#runner=profiler("profiles/master")
runner = timer("tlog-master-mpmath")

for i in range(1, 10):
    fname = "rc" + str(i) + ".anc"

    f = file(fname, "r")
    (identifiers, parents) = dagRead.read(f)
    locations = len(identifiers)
    prior = [1 / float(locations) for i in range(locations)]
    f.close()

    runner.startSet(str(i))

    thisDag = runner.run(dag.dag, (parents, len(parents)))

    finder = BBChop(prior, 0.9, fakeTest(), likelihoods.singleRateCalc,
                    thisDag)

    runner.run(runFinder, [finder])

    runner.write(" ")
示例#5
0
#
#    You should have received a copy of the GNU General Public License
#    along with BBChop.  If not, see <http://www.gnu.org/licenses/>.
import randomdag
import random
import dagRead

try:
    for test in range(100):
        N = random.randint(10, 100)
        dagDef = randomdag.randomdagTxt(N)

        dagDefShuffled = dagDef
        random.shuffle(dagDefShuffled)

        (dagIds, dagParents) = dagRead.read(dagDefShuffled)

        dagCheck = dagDef
        for i in range(len(dagDef)):
            dagTerm = dagIds[i]
            for p in dagParents[i]:
                if p > i:
                    raise "invalidDag"
                dagTerm += ' ' + dagIds[p]
            if dagTerm not in dagCheck:
                raise "missing term"
            dagCheck = [x for x in dagCheck if x != dagTerm]
        print "test %d passed" % (test)
except:
    print "FAILED"
    exit(1)