def mainThread(): global repoFolder if len(sys.argv) < 2: print 'Usage: python jsTester.py <decryptionkey> <repoURL>' sys.exit() if len(sys.argv) == 2: decKey = sys.argv[1] repoURL = '[email protected]:SMU-SIS/TournamentServer-GUI.git' elif len(sys.argv) == 3: decKey = sys.argv[1] repoURL = sys.argv[2] appid,uname = encryptData.readDataAndDecryptDES('keys.txt', decKey) # GitHub configurations GITHUB_USER = uname GITHUB_TOKEN = appid # API Object github = Github(username=GITHUB_USER, api_token=GITHUB_TOKEN) # Get the folder name by splitting the GIT url sp = repoURL.partition('/') repoFolder = sp[2].replace('.git','') # Clone or update the GIT url #gitCloneUpdateRepo(repoURL, repoFolder) # Initiate a thread for executing the JsTestDriver while # the browser is initiated on the main thread thread = threadingJInst() thread.start() print 'Waiting for the Java instance to warm-up' time.sleep(1) brwsr = subprocess.Popen('chromium-browser http://localhost:9876/capture',shell=True) # Run the unit tests execCmd = 'sh ../' + repoFolder + '/gui/scripts/test.sh' # Capture log in a text file os.system(execCmd + '>logUnitTest.txt') # Run the e2e tests execCmd = 'sh ../' + repoFolder + '/gui/scripts/testE2E.sh' # Capture log in a text file os.system(execCmd + '>logE2ETest.txt') # Capturing output of the device on log.txt #fnull = open('log.txt', 'w') #result = subprocess.call(execCmd, shell = True, stdout = fnull, stderr = fnull) #fnull.close() time.sleep(4) os.system('killall -KILL chromium-browser') os.system('killall -KILL java')
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Karthik Muthuswamy # Test for encrpyt/decrypt import encryptData, findDiff from encryptData import encryptDESAndWriteData from findDiff import findDiffOfDirs # Test inputs for GAppID and SPwd - success print encryptDESAndWriteData('APIKey', 'UName', 'code-comparison.txt', 'Key') appid,uname = encryptData.readDataAndDecryptDES('code-comparison.txt', 'Key') print appid print uname # Test inputs for dir1 and dir2 - success #print findDiff.findDiffOfDirs('code-worker','code-worker/code-worker','log')
# Executes a file and logs the result from the downloaded repo import urllib2, json, os, math, time import subprocess, sys, encryptData from commands import getoutput as cmd from github2.client import Github from encryptData import encryptDESAndWriteData if len(sys.argv) < 3: print 'Usage: python worker.py <decryptionkey> <workerName>' sys.exit() elif len(sys.argv) == 3: decKey = sys.argv[1] wrkrName = sys.argv[2] appid,uname = encryptData.readDataAndDecryptDES('keys.txt', decKey) # GitHub configurations GITHUB_USER = uname GITHUB_TOKEN = appid # API Object github = Github(username=GITHUB_USER, api_token=GITHUB_TOKEN) baseURL = 'http://code-comparison.appspot.com/rest/' noJobs = False itr = 0 # The main worker thread that fetches a job def mainWorker(): global itr, noJobs
#!/usr/bin/env python # -*- coding: utf-8 -*- <<<<<<< HEAD # Author: Karthik Muthuswamy # Test for encrpyt/decrypt import encryptData, findDiff from encryptData import encryptDESAndWriteData from findDiff import findDiffOfDirs # Test inputs for GAppID and SPwd - success #print encryptDESAndWriteData('', '', 'keys.txt', 'code-comparison') appid,uname = encryptData.readDataAndDecryptDES('keys.txt', 'code-comparison') # Test inputs for dir1 and dir2 - success #print findDiff.findDiffOfDirs('code-worker','code-worker/code-worker','log') ======= import urllib2, json f = urllib2.urlopen('http://dl.dropbox.com/u/4972572/get_next_job') #f = urllib2.urlopen('http://www.reddit.com/.json') jsonStr = json.load(f) print jsonStr print jsonStr['repo'] print jsonStr['command'] print jsonStr['job_type'] f.close() >>>>>>> 2715950050cbe39d6f0d7e8c57aea77daeaa3a1a
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Karthik Muthuswamy # Uploads target folder to GAE server import sys, pexpect, encryptData from encryptData import encryptDESAndWriteData if len(sys.argv) < 3: print 'Usage: python uploadToGAEServer.py <decryptionkey> <target>' sys.exit() else: decKey = sys.argv[1] target = sys.argv[2] email,pswd = encryptData.readDataAndDecryptDES('code-comparison.txt', decKey) cmd = 'python /home/karthik/google_appengine/appcfg.py --email=' + email + ' update ' + target print cmd child = pexpect.spawn (cmd) i = child.expect([pexpect.TIMEOUT, 'Password for [email protected]:', pexpect.EOF]) if i == 0: print 'No keys found, accepting ssh key permanently!' child.sendline ('yes') i = child.expect([pexpect.TIMEOUT, 'Password for [email protected]:', pexpect.EOF]) elif i == 1: print 'Password requested, sending password' child.sendline (pswd) print 'Password sent' elif i ==2: