Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: test/mozilla/testcfg.py

Issue 183853004: When upgrading the test data twice, don't bail out because of an existing backup (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/test262/testcfg.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 checked_out_version = None 125 checked_out_version = None
126 if os.path.exists(versionfile): 126 if os.path.exists(versionfile):
127 with open(versionfile) as f: 127 with open(versionfile) as f:
128 checked_out_version = f.read() 128 checked_out_version = f.read()
129 if checked_out_version == MOZILLA_VERSION: 129 if checked_out_version == MOZILLA_VERSION:
130 os.chdir(old_cwd) 130 os.chdir(old_cwd)
131 return 131 return
132 132
133 # If we have a local archive file with the test data, extract it. 133 # If we have a local archive file with the test data, extract it.
134 directory_name = "data" 134 directory_name = "data"
135 directory_name_old = "data.old"
135 if os.path.exists(directory_name): 136 if os.path.exists(directory_name):
136 os.rename(directory_name, "data.old") 137 if os.path.exists(directory_name_old):
138 shutil.rmtree(directory_old_name)
Jakob Kummerow 2014/02/28 12:27:10 s/directory_old_name/directory_name_old/ !
139 os.rename(directory_name, directory_name_old)
137 archive_file = "downloaded_%s.tar.gz" % MOZILLA_VERSION 140 archive_file = "downloaded_%s.tar.gz" % MOZILLA_VERSION
138 if os.path.exists(archive_file): 141 if os.path.exists(archive_file):
139 with tarfile.open(archive_file, "r:gz") as tar: 142 with tarfile.open(archive_file, "r:gz") as tar:
140 tar.extractall() 143 tar.extractall()
141 with open(versionfile, "w") as f: 144 with open(versionfile, "w") as f:
142 f.write(MOZILLA_VERSION) 145 f.write(MOZILLA_VERSION)
143 os.chdir(old_cwd) 146 os.chdir(old_cwd)
144 return 147 return
145 148
146 # No cached copy. Check out via CVS, and pack as .tar.gz for later use. 149 # No cached copy. Check out via CVS, and pack as .tar.gz for later use.
147 command = ("cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" 150 command = ("cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot"
148 " co -D %s mozilla/js/tests" % MOZILLA_VERSION) 151 " co -D %s mozilla/js/tests" % MOZILLA_VERSION)
149 code = subprocess.call(command, shell=True) 152 code = subprocess.call(command, shell=True)
150 if code != 0: 153 if code != 0:
151 os.chdir(old_cwd) 154 os.chdir(old_cwd)
152 raise Exception("Error checking out Mozilla test suite!") 155 raise Exception("Error checking out Mozilla test suite!")
153 os.rename(os.path.join("mozilla", "js", "tests"), directory_name) 156 os.rename(os.path.join("mozilla", "js", "tests"), directory_name)
154 shutil.rmtree("mozilla") 157 shutil.rmtree("mozilla")
155 with tarfile.open(archive_file, "w:gz") as tar: 158 with tarfile.open(archive_file, "w:gz") as tar:
156 tar.add("data") 159 tar.add("data")
157 with open(versionfile, "w") as f: 160 with open(versionfile, "w") as f:
158 f.write(MOZILLA_VERSION) 161 f.write(MOZILLA_VERSION)
159 os.chdir(old_cwd) 162 os.chdir(old_cwd)
160 163
161 164
162 def GetSuite(name, root): 165 def GetSuite(name, root):
163 return MozillaTestSuite(name, root) 166 return MozillaTestSuite(name, root)
OLDNEW
« no previous file with comments | « no previous file | test/test262/testcfg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698