def instrument(self, fname, outputPath): path = os.path.join(FileSystem.getWorkingDir(), self.projectName, 'tmp.m') cmd = ['java', '-cp', INJECTPATH, INJECTEXEC, fname, path, outputPath] injectCmd = RunExternal(cmd, 60, True) injectCmd.run() errorCode = injectCmd.getErrorCode() if errorCode != 0: raise Exception('Instrumentation Error!') return path
def __init__(self, hwId, partId): self.hwId = hwId self.partId = partId self.dataDir = os.path.join( FileSystem.getDataDir(), 'octave_unittest/mlclass-ex' + str(self.hwId)) #print(self.dataDir) assert (os.path.exists(self.dataDir)) self._loadCorrect() self.workingDir = os.path.join( FileSystem.getWorkingDir(), 'unitTesting_' + str(self.hwId) + '_' + str(self.partId)) self.createWorkingDir() self.refreshWorkingDir() self._writeUnitTestScript() self._writeUnitTestFilesScript() #print(self.fileScriptName) self.unitTestFile = self.workingDir + '/' + self.getUnitTestFile()
#! /usr/bin/env python import os import sys sys.path.append(os.path.abspath('../../')) from src.util.RunExternal import RunExternal from src.util.FileSystem import FileSystem import MySQLdb as mdb import json import logging ASTCMD = os.path.join(FileSystem.getBinDir(), 'astgen') TARCMD = 'tar -czf' tmpdir = os.path.join(FileSystem.getWorkingDir(), 'octtojson') logdir = os.path.join(FileSystem.getLogDir(), 'octtojson') datadir = os.path.join(FileSystem.getDataDir(), 'ast') astfilePrefix = 'ast' octaveSuffix = '.m' JSONSuffix = '.json' codeSuffix = '.code' mapSuffix = '.map' tarSuffix = '.tar.gz' MAXTIME = 10 # in seconds # Needs to be configured to run properly REMOTEDB = False if REMOTEDB: dbServer = 'galois.stanford.edu' dbUser = '******'