OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Entry point for both build and try bots | 6 """Entry point for both build and try bots |
7 | 7 |
8 This script is invoked from XXX, usually without arguments | 8 This script is invoked from XXX, usually without arguments |
9 to package an SDK. It automatically determines whether | 9 to package an SDK. It automatically determines whether |
10 this SDK is for mac, win, linux. | 10 this SDK is for mac, win, linux. |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 stdout, _ = process.communicate() | 525 stdout, _ = process.communicate() |
526 | 526 |
527 # Parse environment from "set" command above. | 527 # Parse environment from "set" command above. |
528 # It looks like this: | 528 # It looks like this: |
529 # KEY1=VALUE1\r\n | 529 # KEY1=VALUE1\r\n |
530 # KEY2=VALUE2\r\n | 530 # KEY2=VALUE2\r\n |
531 # ... | 531 # ... |
532 return dict(line.split('=') for line in stdout.split('\r\n')[:-1]) | 532 return dict(line.split('=') for line in stdout.split('\r\n')[:-1]) |
533 | 533 |
534 | 534 |
535 def BuildStepBuildLibraries(pepperdir, platform): | 535 def BuildStepBuildLibraries(pepperdir, platform, directory): |
536 buildbot_common.BuildStep('Build Libraries') | 536 buildbot_common.BuildStep('Build Libraries') |
537 src_dir = os.path.join(pepperdir, 'src') | 537 src_dir = os.path.join(pepperdir, directory) |
538 makefile = os.path.join(src_dir, 'Makefile') | 538 makefile = os.path.join(src_dir, 'Makefile') |
539 if os.path.isfile(makefile): | 539 if os.path.isfile(makefile): |
540 print "\n\nMake: " + src_dir | 540 print "\n\nMake: " + src_dir |
541 if platform == 'win': | 541 if platform == 'win': |
542 # We need to modify the environment to build host on Windows. | 542 # We need to modify the environment to build host on Windows. |
543 env = GetWindowsEnvironment() | 543 env = GetWindowsEnvironment() |
544 else: | 544 else: |
545 env = os.environ | 545 env = os.environ |
546 | 546 |
547 buildbot_common.Run(['make', '-j8'], | 547 buildbot_common.Run(['make', '-j8'], |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 print "\n\nMake: " + example_dir | 623 print "\n\nMake: " + example_dir |
624 if platform == 'win': | 624 if platform == 'win': |
625 # We need to modify the environment to build host on Windows. | 625 # We need to modify the environment to build host on Windows. |
626 env = GetWindowsEnvironment() | 626 env = GetWindowsEnvironment() |
627 else: | 627 else: |
628 env = os.environ | 628 env = os.environ |
629 | 629 |
630 buildbot_common.Run(['make', '-j8'], | 630 buildbot_common.Run(['make', '-j8'], |
631 cwd=os.path.abspath(example_dir), shell=True, env=env) | 631 cwd=os.path.abspath(example_dir), shell=True, env=env) |
632 | 632 |
| 633 TEST_EXAMPLE_LIST = [ |
| 634 ] |
| 635 |
| 636 TEST_LIBRARY_LIST = [ |
| 637 'gtest', |
| 638 ] |
| 639 |
| 640 def BuildStepCopyTests(pepperdir, toolchains, build_experimental): |
| 641 buildbot_common.BuildStep('Copy Tests') |
| 642 |
| 643 testingdir = os.path.join(pepperdir, 'testing') |
| 644 buildbot_common.RemoveDir(testingdir) |
| 645 buildbot_common.MakeDir(testingdir) |
| 646 |
| 647 args = ['--dstroot=%s' % pepperdir, '--master'] |
| 648 for toolchain in toolchains: |
| 649 args.append('--' + toolchain) |
| 650 |
| 651 for example in TEST_EXAMPLE_LIST: |
| 652 dsc = os.path.join(SDK_EXAMPLE_DIR, example, 'example.dsc') |
| 653 args.append(dsc) |
| 654 |
| 655 for library in TEST_LIBRARY_LIST: |
| 656 dsc = os.path.join(SDK_LIBRARY_DIR, library, 'library.dsc') |
| 657 args.append(dsc) |
| 658 |
| 659 if build_experimental: |
| 660 args.append('--experimental') |
| 661 |
| 662 if generate_make.main(args): |
| 663 buildbot_common.ErrorExit('Failed to build tests.') |
| 664 |
633 | 665 |
634 def BuildStepTestExamples(pepperdir, platform, pepper_ver): | 666 def BuildStepTestExamples(pepperdir, platform, pepper_ver): |
635 buildbot_common.BuildStep('Test Examples') | 667 buildbot_common.BuildStep('Test Examples') |
636 env = copy.copy(os.environ) | 668 env = copy.copy(os.environ) |
637 env['PEPPER_VER'] = pepper_ver | 669 env['PEPPER_VER'] = pepper_ver |
638 env['NACL_SDK_ROOT'] = pepperdir | 670 env['NACL_SDK_ROOT'] = pepperdir |
639 | 671 |
640 pyauto_script = os.path.join(SRC_DIR, 'chrome', 'test', 'functional', | 672 pyauto_script = os.path.join(SRC_DIR, 'chrome', 'test', 'functional', |
641 'nacl_sdk.py') | 673 'nacl_sdk.py') |
642 pyauto_script_args = ['nacl_sdk.NaClSDKTest.NaClSDKExamples'] | 674 pyauto_script_args = ['nacl_sdk.NaClSDKTest.NaClSDKExamples'] |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 if 'pnacl' in toolchains: | 781 if 'pnacl' in toolchains: |
750 tarname = 'p' + tarname | 782 tarname = 'p' + tarname |
751 tarfile = os.path.join(SERVER_DIR, tarname) | 783 tarfile = os.path.join(SERVER_DIR, tarname) |
752 | 784 |
753 if options.release: | 785 if options.release: |
754 pepper_ver = options.release | 786 pepper_ver = options.release |
755 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) | 787 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) |
756 | 788 |
757 if options.only_examples: | 789 if options.only_examples: |
758 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) | 790 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) |
759 BuildStepBuildLibraries(pepperdir, platform) | 791 BuildStepBuildLibraries(pepperdir, platform, 'src') |
760 BuildStepBuildExamples(pepperdir, platform) | 792 BuildStepBuildExamples(pepperdir, platform) |
| 793 BuildStepCopyTests(pepperdir, toolchains, options.build_experimental) |
| 794 BuildStepBuildLibraries(pepperdir, platform, 'testing') |
761 if options.test_examples: | 795 if options.test_examples: |
762 BuildStepTestExamples(pepperdir, platform, pepper_ver) | 796 BuildStepTestExamples(pepperdir, platform, pepper_ver) |
763 elif options.only_updater: | 797 elif options.only_updater: |
764 build_updater.BuildUpdater(OUT_DIR) | 798 build_updater.BuildUpdater(OUT_DIR) |
765 else: # Build everything. | 799 else: # Build everything. |
766 BuildStepBuildToolsTests() | 800 BuildStepBuildToolsTests() |
767 | 801 |
768 BuildStepDownloadToolchains(platform) | 802 BuildStepDownloadToolchains(platform) |
769 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) | 803 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) |
770 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) | 804 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) |
771 BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) | 805 BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) |
772 BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) | 806 BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) |
773 BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) | 807 BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) |
774 InstallHeaders(os.path.join(pepperdir, 'include'), None, 'libs') | 808 InstallHeaders(os.path.join(pepperdir, 'include'), None, 'libs') |
775 BuildStepCopyBuildHelpers(pepperdir, platform) | 809 BuildStepCopyBuildHelpers(pepperdir, platform) |
776 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) | 810 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) |
777 | 811 |
778 # Ship with libraries prebuilt, so run that first. | 812 # Ship with libraries prebuilt, so run that first. |
779 BuildStepBuildLibraries(pepperdir, platform) | 813 BuildStepBuildLibraries(pepperdir, platform, 'src') |
780 | 814 |
781 if not options.skip_tar: | 815 if not options.skip_tar: |
782 BuildStepTarBundle(pepper_ver, tarfile) | 816 BuildStepTarBundle(pepper_ver, tarfile) |
783 build_updater.BuildUpdater(OUT_DIR) | 817 build_updater.BuildUpdater(OUT_DIR) |
784 | 818 |
785 # BuildStepTestUpdater downloads the bundle to its own directory. Build | 819 # BuildStepTestUpdater downloads the bundle to its own directory. Build |
786 # the examples and test from this directory instead of the original. | 820 # the examples and test from this directory instead of the original. |
787 pepperdir = BuildStepTestUpdater(platform, pepper_ver, clnumber, tarfile) | 821 pepperdir = BuildStepTestUpdater(platform, pepper_ver, clnumber, tarfile) |
788 BuildStepBuildExamples(pepperdir, platform) | 822 BuildStepBuildExamples(pepperdir, platform) |
| 823 BuildStepCopyTests(pepperdir, toolchains, options.build_experimental) |
| 824 BuildStepBuildLibraries(pepperdir, platform, 'testing') |
789 if options.test_examples: | 825 if options.test_examples: |
790 BuildStepTestExamples(pepperdir, platform, pepper_ver) | 826 BuildStepTestExamples(pepperdir, platform, pepper_ver) |
791 | 827 |
792 # Archive on non-trybots. | 828 # Archive on non-trybots. |
793 if options.archive or buildbot_common.IsSDKBuilder(): | 829 if options.archive or buildbot_common.IsSDKBuilder(): |
794 BuildStepArchiveBundle(pepper_ver, clnumber, tarfile) | 830 BuildStepArchiveBundle(pepper_ver, clnumber, tarfile) |
795 BuildStepArchiveSDKTools() | 831 BuildStepArchiveSDKTools() |
796 | 832 |
797 return 0 | 833 return 0 |
798 | 834 |
799 | 835 |
800 if __name__ == '__main__': | 836 if __name__ == '__main__': |
801 sys.exit(main(sys.argv)) | 837 sys.exit(main(sys.argv)) |
OLD | NEW |