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

Side by Side Diff: test/lib/TestGyp.py

Issue 13869005: Dropping the scons generator. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « test/include_dirs/gyptest-default.py ('k') | test/multiple-targets/gyptest-all.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 (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ 5 """
6 TestGyp.py: a testing framework for GYP integration tests. 6 TestGyp.py: a testing framework for GYP integration tests.
7 """ 7 """
8 8
9 import os 9 import os
10 import re 10 import re
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if not os.path.exists(destination_dir): 216 if not os.path.exists(destination_dir):
217 self.subdir(destination_dir) 217 self.subdir(destination_dir)
218 os.rename(source, destination) 218 os.rename(source, destination)
219 219
220 def report_not_up_to_date(self): 220 def report_not_up_to_date(self):
221 """ 221 """
222 Reports that a build is not up-to-date. 222 Reports that a build is not up-to-date.
223 223
224 This provides common reporting for formats that have complicated 224 This provides common reporting for formats that have complicated
225 conditions for checking whether a build is up-to-date. Formats 225 conditions for checking whether a build is up-to-date. Formats
226 that expect exact output from the command (make, scons) can 226 that expect exact output from the command (make) can
227 just set stdout= when they call the run_build() method. 227 just set stdout= when they call the run_build() method.
228 """ 228 """
229 print "Build is not up-to-date:" 229 print "Build is not up-to-date:"
230 print self.banner('STDOUT ') 230 print self.banner('STDOUT ')
231 print self.stdout() 231 print self.stdout()
232 stderr = self.stderr() 232 stderr = self.stderr()
233 if stderr: 233 if stderr:
234 print self.banner('STDERR ') 234 print self.banner('STDERR ')
235 print stderr 235 print stderr
236 236
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 chdir = kw.get('chdir') 857 chdir = kw.get('chdir')
858 if chdir: 858 if chdir:
859 result.append(chdir) 859 result.append(chdir)
860 result.append(self.configuration_dirname()) 860 result.append(self.configuration_dirname())
861 if type == self.STATIC_LIB: 861 if type == self.STATIC_LIB:
862 result.append('lib') 862 result.append('lib')
863 result.append(self.built_file_basename(name, type, **kw)) 863 result.append(self.built_file_basename(name, type, **kw))
864 return self.workpath(*result) 864 return self.workpath(*result)
865 865
866 866
867 class TestGypSCons(TestGypBase):
868 """
869 Subclass for testing the GYP SCons generator.
870 """
871 format = 'scons'
872 build_tool_list = ['scons', 'scons.py']
873 ALL = 'all'
874 def build(self, gyp_file, target=None, **kw):
875 """
876 Runs a scons build using the SCons configuration generated from the
877 specified gyp_file.
878 """
879 arguments = kw.get('arguments', [])[:]
880 dirname = os.path.dirname(gyp_file)
881 if dirname:
882 arguments.extend(['-C', dirname])
883 if self.configuration:
884 arguments.append('--mode=' + self.configuration)
885 if target not in (None, self.DEFAULT):
886 arguments.append(target)
887 kw['arguments'] = arguments
888 return self.run(program=self.build_tool, **kw)
889 def up_to_date(self, gyp_file, target=None, **kw):
890 """
891 Verifies that a build of the specified SCons target is up to date.
892 """
893 if target in (None, self.DEFAULT):
894 up_to_date_targets = 'all'
895 else:
896 up_to_date_targets = target
897 up_to_date_lines = []
898 for arg in up_to_date_targets.split():
899 up_to_date_lines.append("scons: `%s' is up to date.\n" % arg)
900 kw['stdout'] = ''.join(up_to_date_lines)
901 arguments = kw.get('arguments', [])[:]
902 arguments.append('-Q')
903 kw['arguments'] = arguments
904 return self.build(gyp_file, target, **kw)
905 def run_built_executable(self, name, *args, **kw):
906 """
907 Runs an executable built by scons.
908 """
909 configuration = self.configuration_dirname()
910 os.environ['LD_LIBRARY_PATH'] = os.path.join(configuration, 'lib')
911 # Enclosing the name in a list avoids prepending the original dir.
912 program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)]
913 return self.run(program=program, *args, **kw)
914 def built_file_path(self, name, type=None, **kw):
915 """
916 Returns a path to the specified file name, of the specified type,
917 as built by Scons.
918
919 Built files are in a subdirectory that matches the configuration
920 name. The default is 'Default'.
921
922 A chdir= keyword argument specifies the source directory
923 relative to which the output subdirectory can be found.
924
925 "type" values of STATIC_LIB or SHARED_LIB append the necessary
926 prefixes and suffixes to a platform-independent library base name.
927 """
928 result = []
929 chdir = kw.get('chdir')
930 if chdir:
931 result.append(chdir)
932 result.append(self.configuration_dirname())
933 if type in (self.STATIC_LIB, self.SHARED_LIB):
934 result.append('lib')
935 result.append(self.built_file_basename(name, type, **kw))
936 return self.workpath(*result)
937
938
939 class TestGypXcode(TestGypBase): 867 class TestGypXcode(TestGypBase):
940 """ 868 """
941 Subclass for testing the GYP Xcode generator. 869 Subclass for testing the GYP Xcode generator.
942 """ 870 """
943 format = 'xcode' 871 format = 'xcode'
944 build_tool_list = ['xcodebuild'] 872 build_tool_list = ['xcodebuild']
945 873
946 phase_script_execution = ("\n" 874 phase_script_execution = ("\n"
947 "PhaseScriptExecution /\\S+/Script-[0-9A-F]+\\.sh\n" 875 "PhaseScriptExecution /\\S+/Script-[0-9A-F]+\\.sh\n"
948 " cd /\\S+\n" 876 " cd /\\S+\n"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 result.append(self.built_file_basename(name, type, **kw)) 972 result.append(self.built_file_basename(name, type, **kw))
1045 return self.workpath(*result) 973 return self.workpath(*result)
1046 974
1047 975
1048 format_class_list = [ 976 format_class_list = [
1049 TestGypGypd, 977 TestGypGypd,
1050 TestGypAndroid, 978 TestGypAndroid,
1051 TestGypMake, 979 TestGypMake,
1052 TestGypMSVS, 980 TestGypMSVS,
1053 TestGypNinja, 981 TestGypNinja,
1054 TestGypSCons,
1055 TestGypXcode, 982 TestGypXcode,
1056 ] 983 ]
1057 984
1058 def TestGyp(*args, **kw): 985 def TestGyp(*args, **kw):
1059 """ 986 """
1060 Returns an appropriate TestGyp* instance for a specified GYP format. 987 Returns an appropriate TestGyp* instance for a specified GYP format.
1061 """ 988 """
1062 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT')) 989 format = kw.pop('format', os.environ.get('TESTGYP_FORMAT'))
1063 for format_class in format_class_list: 990 for format_class in format_class_list:
1064 if format == format_class.format: 991 if format == format_class.format:
1065 return format_class(*args, **kw) 992 return format_class(*args, **kw)
1066 raise Exception, "unknown format %r" % format 993 raise Exception, "unknown format %r" % format
OLDNEW
« no previous file with comments | « test/include_dirs/gyptest-default.py ('k') | test/multiple-targets/gyptest-all.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698