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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 stdout, _ = process.communicate() | 529 stdout, _ = process.communicate() |
530 | 530 |
531 # Parse environment from "set" command above. | 531 # Parse environment from "set" command above. |
532 # It looks like this: | 532 # It looks like this: |
533 # KEY1=VALUE1\r\n | 533 # KEY1=VALUE1\r\n |
534 # KEY2=VALUE2\r\n | 534 # KEY2=VALUE2\r\n |
535 # ... | 535 # ... |
536 return dict(line.split('=') for line in stdout.split('\r\n')[:-1]) | 536 return dict(line.split('=') for line in stdout.split('\r\n')[:-1]) |
537 | 537 |
538 | 538 |
539 def BuildStepBuildLibraries(pepperdir, platform, directory): | 539 def BuildStepMakeAll(pepperdir, platform, directory, step_name, clean=False): |
540 buildbot_common.BuildStep('Build Libraries') | 540 buildbot_common.BuildStep(step_name) |
541 src_dir = os.path.join(pepperdir, directory) | 541 make_dir = os.path.join(pepperdir, directory) |
542 makefile = os.path.join(src_dir, 'Makefile') | 542 makefile = os.path.join(make_dir, 'Makefile') |
543 if os.path.isfile(makefile): | 543 if os.path.isfile(makefile): |
544 print "\n\nMake: " + src_dir | 544 print "\n\nMake: " + make_dir |
545 if platform == 'win': | 545 if platform == 'win': |
546 # We need to modify the environment to build host on Windows. | 546 # We need to modify the environment to build host on Windows. |
547 env = GetWindowsEnvironment() | 547 env = GetWindowsEnvironment() |
548 else: | 548 else: |
549 env = os.environ | 549 env = os.environ |
550 | 550 |
551 buildbot_common.Run(['make', '-j8'], | 551 buildbot_common.Run(['make', '-j8'], |
552 cwd=os.path.abspath(src_dir), shell=True, env=env) | 552 cwd=os.path.abspath(make_dir), shell=True, env=env) |
553 # Clean to remove temporary files but keep the built libraries. | 553 if clean: |
554 buildbot_common.Run(['make', '-j8', 'clean'], | 554 # Clean to remove temporary files but keep the built libraries. |
555 cwd=os.path.abspath(src_dir), shell=True) | 555 buildbot_common.Run(['make', '-j8', 'clean'], |
| 556 cwd=os.path.abspath(make_dir), shell=True) |
| 557 |
| 558 |
| 559 def BuildStepBuildLibraries(pepperdir, platform, directory): |
| 560 BuildStepMakeAll(pepperdir, platform, directory, 'Build Libraries', |
| 561 clean=True) |
556 | 562 |
557 | 563 |
558 def BuildStepTarBundle(pepper_ver, tarfile): | 564 def BuildStepTarBundle(pepper_ver, tarfile): |
559 buildbot_common.BuildStep('Tar Pepper Bundle') | 565 buildbot_common.BuildStep('Tar Pepper Bundle') |
560 buildbot_common.MakeDir(os.path.dirname(tarfile)) | 566 buildbot_common.MakeDir(os.path.dirname(tarfile)) |
561 buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, | 567 buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, |
562 'pepper_' + pepper_ver], cwd=NACL_DIR) | 568 'pepper_' + pepper_ver], cwd=NACL_DIR) |
563 | 569 |
564 | 570 |
565 def GetManifestBundle(pepper_ver, revision, tarfile, archive_url): | 571 def GetManifestBundle(pepper_ver, revision, tarfile, archive_url): |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 # Return the new pepper directory as the one inside the downloaded SDK. | 619 # Return the new pepper directory as the one inside the downloaded SDK. |
614 return os.path.join(OUT_DIR, 'nacl_sdk', 'pepper_' + pepper_ver) | 620 return os.path.join(OUT_DIR, 'nacl_sdk', 'pepper_' + pepper_ver) |
615 | 621 |
616 # kill server | 622 # kill server |
617 finally: | 623 finally: |
618 if server: | 624 if server: |
619 server.Shutdown() | 625 server.Shutdown() |
620 | 626 |
621 | 627 |
622 def BuildStepBuildExamples(pepperdir, platform): | 628 def BuildStepBuildExamples(pepperdir, platform): |
623 buildbot_common.BuildStep('Build Examples') | 629 BuildStepMakeAll(pepperdir, platform, 'examples', 'Build Examples') |
624 example_dir = os.path.join(pepperdir, 'examples') | |
625 makefile = os.path.join(example_dir, 'Makefile') | |
626 if os.path.isfile(makefile): | |
627 print "\n\nMake: " + example_dir | |
628 if platform == 'win': | |
629 # We need to modify the environment to build host on Windows. | |
630 env = GetWindowsEnvironment() | |
631 else: | |
632 env = os.environ | |
633 | 630 |
634 buildbot_common.Run(['make', '-j8'], | |
635 cwd=os.path.abspath(example_dir), shell=True, env=env) | |
636 | 631 |
637 TEST_EXAMPLE_LIST = [ | 632 TEST_EXAMPLE_LIST = [ |
| 633 'nacl_mounts_test', |
638 ] | 634 ] |
639 | 635 |
640 TEST_LIBRARY_LIST = [ | 636 TEST_LIBRARY_LIST = [ |
641 'gtest', | 637 'gtest', |
642 ] | 638 ] |
643 | 639 |
644 def BuildStepCopyTests(pepperdir, toolchains, build_experimental): | 640 def BuildStepCopyTests(pepperdir, toolchains, build_experimental): |
645 buildbot_common.BuildStep('Copy Tests') | 641 buildbot_common.BuildStep('Copy Tests') |
646 | 642 |
647 testingdir = os.path.join(pepperdir, 'testing') | 643 testingdir = os.path.join(pepperdir, 'testing') |
648 buildbot_common.RemoveDir(testingdir) | 644 buildbot_common.RemoveDir(testingdir) |
649 buildbot_common.MakeDir(testingdir) | 645 buildbot_common.MakeDir(testingdir) |
650 | 646 |
651 args = ['--dstroot=%s' % pepperdir, '--master'] | 647 args = ['--dstroot=%s' % pepperdir, '--master'] |
652 for toolchain in toolchains: | 648 for toolchain in toolchains: |
653 args.append('--' + toolchain) | 649 args.append('--' + toolchain) |
654 | 650 |
655 for example in TEST_EXAMPLE_LIST: | |
656 dsc = os.path.join(SDK_EXAMPLE_DIR, example, 'example.dsc') | |
657 args.append(dsc) | |
658 | |
659 for library in TEST_LIBRARY_LIST: | 651 for library in TEST_LIBRARY_LIST: |
660 dsc = os.path.join(SDK_LIBRARY_DIR, library, 'library.dsc') | 652 dsc = os.path.join(SDK_LIBRARY_DIR, library, 'library.dsc') |
661 args.append(dsc) | 653 args.append(dsc) |
662 | 654 |
| 655 for example in TEST_EXAMPLE_LIST: |
| 656 dsc = os.path.join(SDK_LIBRARY_DIR, example, 'example.dsc') |
| 657 args.append(dsc) |
| 658 |
663 if build_experimental: | 659 if build_experimental: |
664 args.append('--experimental') | 660 args.append('--experimental') |
665 | 661 |
666 if generate_make.main(args): | 662 if generate_make.main(args): |
667 buildbot_common.ErrorExit('Failed to build tests.') | 663 buildbot_common.ErrorExit('Failed to build tests.') |
668 | 664 |
669 | 665 |
670 def BuildStepTestExamples(pepperdir, platform, pepper_ver): | 666 def BuildStepBuildTests(pepperdir, platform): |
| 667 BuildStepMakeAll(pepperdir, platform, 'testing', 'Build Tests') |
| 668 |
| 669 |
| 670 def BuildStepRunPyautoTests(pepperdir, platform, pepper_ver): |
671 buildbot_common.BuildStep('Test Examples') | 671 buildbot_common.BuildStep('Test Examples') |
672 env = copy.copy(os.environ) | 672 env = copy.copy(os.environ) |
673 env['PEPPER_VER'] = pepper_ver | 673 env['PEPPER_VER'] = pepper_ver |
674 env['NACL_SDK_ROOT'] = pepperdir | 674 env['NACL_SDK_ROOT'] = pepperdir |
675 | 675 |
676 pyauto_script = os.path.join(SRC_DIR, 'chrome', 'test', 'functional', | 676 pyauto_script = os.path.join(SRC_DIR, 'chrome', 'test', 'functional', |
677 'nacl_sdk.py') | 677 'nacl_sdk.py') |
678 pyauto_script_args = ['nacl_sdk.NaClSDKTest.NaClSDKExamples'] | 678 pyauto_script_args = ['nacl_sdk.NaClSDKTest.NaClSDKExamples'] |
679 | 679 |
680 if platform == 'linux' and buildbot_common.IsSDKBuilder(): | 680 if platform == 'linux' and buildbot_common.IsSDKBuilder(): |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 788 |
789 if options.release: | 789 if options.release: |
790 pepper_ver = options.release | 790 pepper_ver = options.release |
791 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) | 791 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) |
792 | 792 |
793 if options.only_examples: | 793 if options.only_examples: |
794 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) | 794 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) |
795 BuildStepBuildLibraries(pepperdir, platform, 'src') | 795 BuildStepBuildLibraries(pepperdir, platform, 'src') |
796 BuildStepBuildExamples(pepperdir, platform) | 796 BuildStepBuildExamples(pepperdir, platform) |
797 BuildStepCopyTests(pepperdir, toolchains, options.build_experimental) | 797 BuildStepCopyTests(pepperdir, toolchains, options.build_experimental) |
798 BuildStepBuildLibraries(pepperdir, platform, 'testing') | 798 BuildStepBuildTests(pepperdir, platform) |
799 if options.test_examples: | 799 if options.test_examples: |
800 BuildStepTestExamples(pepperdir, platform, pepper_ver) | 800 BuildStepRunPyautoTests(pepperdir, platform, pepper_ver) |
801 elif options.only_updater: | 801 elif options.only_updater: |
802 build_updater.BuildUpdater(OUT_DIR) | 802 build_updater.BuildUpdater(OUT_DIR) |
803 else: # Build everything. | 803 else: # Build everything. |
804 BuildStepBuildToolsTests() | 804 BuildStepBuildToolsTests() |
805 | 805 |
806 BuildStepDownloadToolchains(platform) | 806 BuildStepDownloadToolchains(platform) |
807 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) | 807 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) |
808 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) | 808 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) |
809 BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) | 809 BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) |
810 BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) | 810 BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) |
811 BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) | 811 BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) |
812 InstallHeaders(os.path.join(pepperdir, 'include'), None, 'libs') | 812 InstallHeaders(os.path.join(pepperdir, 'include'), None, 'libs') |
813 BuildStepCopyBuildHelpers(pepperdir, platform) | 813 BuildStepCopyBuildHelpers(pepperdir, platform) |
814 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) | 814 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) |
815 | 815 |
816 # Ship with libraries prebuilt, so run that first. | 816 # Ship with libraries prebuilt, so run that first. |
817 BuildStepBuildLibraries(pepperdir, platform, 'src') | 817 BuildStepBuildLibraries(pepperdir, platform, 'src') |
818 | 818 |
819 if not options.skip_tar: | 819 if not options.skip_tar: |
820 BuildStepTarBundle(pepper_ver, tarfile) | 820 BuildStepTarBundle(pepper_ver, tarfile) |
821 build_updater.BuildUpdater(OUT_DIR) | 821 build_updater.BuildUpdater(OUT_DIR) |
822 | 822 |
823 # BuildStepTestUpdater downloads the bundle to its own directory. Build | 823 # BuildStepTestUpdater downloads the bundle to its own directory. Build |
824 # the examples and test from this directory instead of the original. | 824 # the examples and test from this directory instead of the original. |
825 pepperdir = BuildStepTestUpdater(platform, pepper_ver, clnumber, tarfile) | 825 pepperdir = BuildStepTestUpdater(platform, pepper_ver, clnumber, tarfile) |
826 BuildStepBuildExamples(pepperdir, platform) | 826 BuildStepBuildExamples(pepperdir, platform) |
827 BuildStepCopyTests(pepperdir, toolchains, options.build_experimental) | 827 BuildStepCopyTests(pepperdir, toolchains, options.build_experimental) |
828 BuildStepBuildLibraries(pepperdir, platform, 'testing') | 828 BuildStepBuildTests(pepperdir, platform) |
829 if options.test_examples: | 829 if options.test_examples: |
830 BuildStepTestExamples(pepperdir, platform, pepper_ver) | 830 BuildStepRunPyautoTests(pepperdir, platform, pepper_ver) |
831 | 831 |
832 # Archive on non-trybots. | 832 # Archive on non-trybots. |
833 if options.archive or buildbot_common.IsSDKBuilder(): | 833 if options.archive or buildbot_common.IsSDKBuilder(): |
834 BuildStepArchiveBundle(pepper_ver, clnumber, tarfile) | 834 BuildStepArchiveBundle(pepper_ver, clnumber, tarfile) |
835 BuildStepArchiveSDKTools() | 835 BuildStepArchiveSDKTools() |
836 | 836 |
837 return 0 | 837 return 0 |
838 | 838 |
839 | 839 |
840 if __name__ == '__main__': | 840 if __name__ == '__main__': |
841 sys.exit(main(sys.argv)) | 841 sys.exit(main(sys.argv)) |
OLD | NEW |