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

Side by Side Diff: tools/utils.py

Issue 1697203002: Switch to downloaded SDK executable, drop executables in testing/bin. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | 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, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # This file contains a set of utilities functions used by other Python-based 5 # This file contains a set of utilities functions used by other Python-based
6 # scripts. 6 # scripts.
7 7
8 import commands 8 import commands
9 import datetime 9 import datetime
10 import json 10 import json
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 """Execute a command in a subprocess.""" 566 """Execute a command in a subprocess."""
567 print 'Executing: ' + ' '.join(cmd) 567 print 'Executing: ' + ' '.join(cmd)
568 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 568 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
569 shell=IsWindows()) 569 shell=IsWindows())
570 output = pipe.communicate() 570 output = pipe.communicate()
571 if pipe.returncode != 0: 571 if pipe.returncode != 0:
572 raise Exception('Execution failed: ' + str(output)) 572 raise Exception('Execution failed: ' + str(output))
573 return pipe.returncode, output 573 return pipe.returncode, output
574 574
575 575
576 def DartBinary():
577 # TODO(24311): Replace all uses of this with CheckedInSdk[Fix]Executable().
578 tools_dir = os.path.dirname(os.path.realpath(__file__))
579 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin')
580 if IsWindows():
581 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe')
582 else:
583 arch = GuessArchitecture()
584 system = GuessOS()
585 if arch == 'armv5te':
586 # TODO(zra): This binary does not exist, yet. Check one in once we have
587 # sufficient stability.
588 return os.path.join(dart_binary_prefix, system, 'dart-armv5te')
589 elif arch == 'armv6':
590 # TODO(zra): Ditto.
591 return os.path.join(dart_binary_prefix, system, 'dart-armv6')
592 elif arch == 'arm':
593 return os.path.join(dart_binary_prefix, system, 'dart-arm')
594 elif arch == 'arm64':
595 return os.path.join(dart_binary_prefix, system, 'dart-arm64')
596 elif arch == 'mips':
597 return os.path.join(dart_binary_prefix, system, 'dart-mips')
598 else:
599 return os.path.join(dart_binary_prefix, system, 'dart')
600
601
602 def DartSdkBinary():
603 tools_dir = os.path.dirname(os.path.realpath(__file__))
604 dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin')
605 return os.path.join(dart_binary_prefix, 'dart')
606
607
608 # The checked-in SDKs are documented at 576 # The checked-in SDKs are documented at
609 # https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools 577 # https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools
610 def CheckedInSdkPath(): 578 def CheckedInSdkPath():
611 # We don't use the normal macos, linux, win32 directory names here, instead, 579 # We don't use the normal macos, linux, win32 directory names here, instead,
612 # we use the names that the download_from_google_storage script uses. 580 # we use the names that the download_from_google_storage script uses.
613 osdict = {'Darwin':'mac', 'Linux':'linux', 'Windows':'win'} 581 osdict = {'Darwin':'mac', 'Linux':'linux', 'Windows':'win'}
614 system = platform.system() 582 system = platform.system()
615 try: 583 try:
616 osname = osdict[system] 584 osname = osdict[system]
617 except KeyError: 585 except KeyError:
(...skipping 11 matching lines...) Expand all
629 if IsWindows(): 597 if IsWindows():
630 name = 'dart.exe' 598 name = 'dart.exe'
631 elif GuessOS() == 'linux': 599 elif GuessOS() == 'linux':
632 arch = GuessArchitecture() 600 arch = GuessArchitecture()
633 if arch == 'mips': 601 if arch == 'mips':
634 name = 'dart-mips' 602 name = 'dart-mips'
635 elif arch == 'arm': 603 elif arch == 'arm':
636 name = 'dart-arm' 604 name = 'dart-arm'
637 elif arch == 'arm64': 605 elif arch == 'arm64':
638 name = 'dart-arm64' 606 name = 'dart-arm64'
607 elif arch == 'armv5te':
608 # TODO(zra): This binary does not exist, yet. Check one in once we have
609 # sufficient stability.
610 name = 'dart-armv5te'
611 elif arch == 'armv6':
612 # TODO(zra): Ditto.
613 name = 'dart-armv6'
639 return os.path.join(CheckedInSdkPath(), 'bin', name) 614 return os.path.join(CheckedInSdkPath(), 'bin', name)
640 615
641 616
642 def CheckedInSdkCheckExecutable(): 617 def CheckedInSdkCheckExecutable():
643 executable = CheckedInSdkExecutable() 618 executable = CheckedInSdkExecutable()
644 canary_script = os.path.join(os.path.dirname(os.path.realpath(__file__)), 619 canary_script = os.path.join(os.path.dirname(os.path.realpath(__file__)),
645 'canary.dart') 620 'canary.dart')
646 try: 621 try:
647 with open(os.devnull, 'wb') as silent_sink: 622 with open(os.devnull, 'wb') as silent_sink:
648 if 0 == subprocess.call([executable, canary_script], stdout=silent_sink): 623 if 0 == subprocess.call([executable, canary_script], stdout=silent_sink):
(...skipping 25 matching lines...) Expand all
674 os.chdir(self._working_directory) 649 os.chdir(self._working_directory)
675 650
676 def __exit__(self, *_): 651 def __exit__(self, *_):
677 print "Enter directory = ", self._old_cwd 652 print "Enter directory = ", self._old_cwd
678 os.chdir(self._old_cwd) 653 os.chdir(self._old_cwd)
679 654
680 655
681 if __name__ == "__main__": 656 if __name__ == "__main__":
682 import sys 657 import sys
683 Main() 658 Main()
OLDNEW
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698