diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rwxr-xr-x | check.py | 13 | ||||
-rw-r--r-- | test/lkgr | 1 | ||||
-rwxr-xr-x | update.py | 52 |
4 files changed, 48 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore index f99ebcb99..0fcf35ca6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ cmake_install.cmake *.ninja .ninja_deps .ninja_log -buildbot/ +test/wasm-torture-s-*.tbz2 +test/s2wasm-torture-out @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os, sys, subprocess, difflib, json, time +import os, shutil, sys, subprocess, difflib, json, time interpreter = None requested = [] @@ -278,14 +278,15 @@ for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(o print '\n[ checking torture testcases... ]\n' import test.experimental.buildbot.link_assembly_files as link_assembly_files -s2wasm_out = os.path.abspath(os.path.join('buildbot', 's2wasm-out')) -if not os.path.isdir(s2wasm_out): - os.mkdir(s2wasm_out) +s2wasm_torture_out = os.path.abspath(os.path.join('test', 's2wasm-torture-out')) +if os.path.isdir(s2wasm_torture_out): + shutil.rmtree(s2wasm_torture_out) +os.mkdir(s2wasm_torture_out) unexpected_result_count = link_assembly_files.run( linker=os.path.abspath(os.path.join('bin', 's2wasm')), - files=os.path.abspath(os.path.join('buildbot', 'torture-s', '*.s')), + files=os.path.abspath(os.path.join('test', 'torture-s', '*.s')), fails=os.path.abspath(os.path.join('test', 's2wasm_known_gcc_test_failures.txt')), - out=s2wasm_out) + out=s2wasm_torture_out) if unexpected_result_count: fail(unexpected_result_count, 0) diff --git a/test/lkgr b/test/lkgr new file mode 100644 index 000000000..b208b565e --- /dev/null +++ b/test/lkgr @@ -0,0 +1 @@ +d8f6d5cdd7114f8e31f75f76752738170e83c8e9
\ No newline at end of file @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import glob import os +import shutil import subprocess import sys import tempfile @@ -22,23 +24,44 @@ import urllib2 STORAGE_BASE = 'https://storage.googleapis.com/wasm-llvm/builds/git/' +BASE_DIR = 'test' +LKGR_PATH = os.path.join(BASE_DIR, 'lkgr') +TORTURE_TAR = 'wasm-torture-s-%s.tbz2' +TORTURE_FOLDER = os.path.join(BASE_DIR, 'torture-s') -def update_torture(): - if not os.path.isdir('buildbot'): - os.mkdir('buildbot') - lkgr_path = os.path.join('buildbot', 'lkgr') - with open(lkgr_path, 'w+') as f: +def download_last_known_good_revision(): + with open(LKGR_PATH, 'w+') as f: lkgr = urllib2.urlopen(STORAGE_BASE + 'lkgr').read().strip() f.write(lkgr) - torture = 'wasm-torture-s-%s.tbz2' % lkgr - torture_path = os.path.join('buildbot', torture) - if not os.path.isfile(torture_path): - with open(torture_path, 'w+') as f: - f.write(urllib2.urlopen(STORAGE_BASE + torture).read()) - with tempfile.TemporaryFile(mode='w') as untar: - subprocess.check_call(['tar', '-xvf', torture], cwd='buildbot', - stdout=untar) + return lkgr + + +def download_tar_at_lkgr(tar_pattern, lkgr): + tar_path = os.path.join(BASE_DIR, tar_pattern) + lkgr_tar_path = tar_path % lkgr + if not os.path.isfile(lkgr_tar_path): + with open(lkgr_tar_path, 'w+') as f: + f.write(urllib2.urlopen(STORAGE_BASE + tar_pattern % lkgr).read()) + # Remove any previous tarfiles. + for older_tar in glob.glob(tar_path): + if older_tar != lkgr_tar_path: + os.path.remove(older_tar) + return lkgr_tar_path + + +def untar(tarfile, outfolder): + if os.path.exists(outfolder): + shutil.rmtree(outfolder) + with tempfile.TemporaryFile(mode='w+') as f: + try: + base = os.path.basename(tarfile) + subprocess.check_call(['tar', '-xvf', base], cwd=BASE_DIR, stdout=f) + except: + f.seek(0) + sys.stderr.write(f.read()) + raise + assert os.path.isdir(outfolder), 'Expected to untar into %s' % outfolder def main(): @@ -47,7 +70,8 @@ def main(): subprocess.check_call(['git', 'submodule', 'update', '--quiet']) subprocess.check_call(['git', 'submodule', 'foreach', 'git', 'pull', 'origin', 'master', '--quiet']) - update_torture() + lkgr = download_last_known_good_revision() + untar(download_tar_at_lkgr(TORTURE_TAR, lkgr), TORTURE_FOLDER) if __name__ == '__main__': |