(number, comment_url, clone_url, commit)
| 97 | resp = requests.post(commentUrl, json.dumps(post_data), auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"])) |
| 98 | |
| 99 | def testpull(number, comment_url, clone_url, commit): |
| 100 | print("Testing pull %d: %s : %s"%(number, clone_url,commit)) |
| 101 | |
| 102 | dir = os.environ["RESULTS_DIR"] + "/" + commit + "/" |
| 103 | print(" ouput to %s"%dir) |
| 104 | if os.path.exists(dir): |
| 105 | os.system("rm -r " + dir) |
| 106 | os.makedirs(dir) |
| 107 | currentdir = os.environ["RESULTS_DIR"] + "/current" |
| 108 | os.system("rm -r "+currentdir) |
| 109 | os.system("ln -s " + dir + " " + currentdir) |
| 110 | out = open(dir + "test.log", 'w+') |
| 111 | |
| 112 | resultsurl = os.environ["RESULTS_URL"] + commit |
| 113 | checkedout = checkout_pull(clone_url, commit, out) |
| 114 | if checkedout != True: |
| 115 | print("Failed to test pull - sending comment to: " + comment_url) |
| 116 | commentOn(comment_url, False, True, False, resultsurl) |
| 117 | open(os.environ["TESTED_DB"], "a").write(commit + "\n") |
| 118 | return |
| 119 | |
| 120 | run("rm -rf ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False); |
| 121 | run("mkdir -p ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False); |
| 122 | run("chown -R ${BUILD_USER}:${BUILD_GROUP} ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False) |
| 123 | |
| 124 | script = os.environ["BUILD_PATH"]+"/qa/pull-tester/pull-tester.sh" |
| 125 | script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool_jar/BitcoindComparisonTool.jar 0 6 ${OUT_DIR}" |
| 126 | returncode = run("chroot ${CHROOT_COPY} sudo -u ${BUILD_USER} -H timeout ${TEST_TIMEOUT} "+script, |
| 127 | fail_hard=False, stdout=out, stderr=out) |
| 128 | |
| 129 | run("mv ${CHROOT_COPY}/${OUT_DIR} " + dir) |
| 130 | run("mv ${BUILD_DIR} " + dir) |
| 131 | |
| 132 | if returncode == 42: |
| 133 | print("Successfully tested pull (needs tests) - sending comment to: " + comment_url) |
| 134 | commentOn(comment_url, True, False, True, resultsurl) |
| 135 | elif returncode != 0: |
| 136 | print("Failed to test pull - sending comment to: " + comment_url) |
| 137 | commentOn(comment_url, False, False, False, resultsurl) |
| 138 | else: |
| 139 | print("Successfully tested pull - sending comment to: " + comment_url) |
| 140 | commentOn(comment_url, True, False, False, resultsurl) |
| 141 | open(os.environ["TESTED_DB"], "a").write(commit + "\n") |
| 142 | |
| 143 | def environ_default(setting, value): |
| 144 | if not setting in os.environ: |
no test coverage detected