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

Side by Side Diff: tools/llvm/utman.sh

Issue 7004033: This CL splits out the testing subpart of utman.sh into a separate script (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 7 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 | tools/llvm/utman-test.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2011 The Native Client 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 #@ Untrusted Toolchain Manager 6 #@ Untrusted Toolchain Manager
7 #@------------------------------------------------------------------- 7 #@-------------------------------------------------------------------
8 #@ This script builds the ARM and PNaCl untrusted toolchains. 8 #@ This script builds the ARM and PNaCl untrusted toolchains.
9 #@ It MUST be run from the native_client/ directory. 9 #@ It MUST be run from the native_client/ directory.
10 # 10 #
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 2768
2769 if ! cmp --silent "${archllc}" "${newllc}" ; then 2769 if ! cmp --silent "${archllc}" "${newllc}" ; then
2770 Banner "TRIPLE BUILD VERIFY FAILED" 2770 Banner "TRIPLE BUILD VERIFY FAILED"
2771 echo "Expected these files to be identical, but they are not:" 2771 echo "Expected these files to be identical, but they are not:"
2772 echo " ${archllc}" 2772 echo " ${archllc}"
2773 echo " ${newllc}" 2773 echo " ${newllc}"
2774 exit -1 2774 exit -1
2775 fi 2775 fi
2776 StepBanner "VERIFY" "Verified ${arch} OK" 2776 StepBanner "VERIFY" "Verified ${arch} OK"
2777 } 2777 }
2778 ######################################################################
2779 ######################################################################
2780 #
2781 # < TESTING >
2782 #
2783 ######################################################################
2784 ######################################################################
2785
2786 # TODO(robertm): figure out what to do about concurrency in debug mode.
2787 # Perhaps it is fine just tweaking that via UTMAN_CONCURRENCY.
2788 if ${UTMAN_DEBUG} || ${UTMAN_BUILDBOT}; then
2789 readonly SCONS_ARGS=(MODE=nacl,opt-host
2790 bitcode=1
2791 sdl=none
2792 --verbose
2793 -j${UTMAN_CONCURRENCY})
2794
2795 readonly SCONS_ARGS_SEL_LDR=(MODE=opt-host
2796 bitcode=1
2797 sdl=none
2798 --verbose
2799 -j${UTMAN_CONCURRENCY})
2800 else
2801 readonly SCONS_ARGS=(MODE=nacl,opt-host
2802 bitcode=1
2803 naclsdk_validate=0
2804 sdl=none
2805 sysinfo=0
2806 -j${UTMAN_CONCURRENCY})
2807
2808 readonly SCONS_ARGS_SEL_LDR=(MODE=opt-host
2809 bitcode=1
2810 naclsdk_validate=0
2811 sdl=none
2812 sysinfo=0
2813 -j${UTMAN_CONCURRENCY})
2814 fi
2815
2816 #@ show-tests - see what tests can be run
2817 show-tests() {
2818 StepBanner "SHOWING TESTS"
2819 cat $(find tests -name nacl.scons) | grep -o 'run_[A-Za-z_-]*' | sort | uniq
2820 }
2821
2822 #+ scons-determine-tests - returns:
2823 #+ (a) "true smoke_tests [-k]" if all smoke tests should be built and run.
2824 #+ or (b) "false $@" if not all tests should be built because specific tests
2825 #+ are already identified in $@. The test must be the first element
2826 #+ of $@, but we don't check that here.
2827 scons-determine-tests() {
2828 if [ $# -eq 0 ] || ([ $# -eq 1 ] && [ "$1" == "-k" ]); then
2829 echo "true smoke_tests $@" # $@ should only tack on the -k flag or nothing
2830 else
2831 echo "false $@"
2832 fi
2833 }
2834
2835 scons-build-sel_ldr() {
2836 local platform=$1
2837 ./scons platform=${platform} ${SCONS_ARGS_SEL_LDR[@]} sel_ldr
2838 }
2839
2840 scons-build-sel_universal() {
2841 local platform=$1
2842 ./scons platform=${platform} ${SCONS_ARGS_SEL_LDR[@]} sel_universal
2843 }
2844
2845 scons-clean-pnacl-build-dir () {
2846 rm -rf scons-out/nacl-$1-pnacl
2847 }
2848
2849 scons-clean-pnacl-pic-build-dir () {
2850 rm -rf scons-out/nacl-$1-pnacl-pic
2851 }
2852
2853 scons-pnacl-build () {
2854 local platform=$1
2855 shift
2856 ./scons ${SCONS_ARGS[@]} \
2857 platform=${platform} \
2858 "$@"
2859 }
2860
2861 run-scons-tests() {
2862 local platform=$1
2863 local should_build_all=$2
2864 local testname=$3
2865 shift 3
2866 # The rest of the arguments should be flags!
2867
2868 # See if we should build all the tests.
2869 if ${should_build_all}; then
2870 scons-pnacl-build ${platform} $@
2871 fi
2872
2873 # Then run the listed tests.
2874 scons-pnacl-build ${platform} ${testname} $@
2875 }
2876
2877 test-scons-common () {
2878 local platform=$1
2879 shift
2880 scons-clean-pnacl-build-dir ${platform}
2881
2882 test_setup=$(scons-determine-tests "$@")
2883 run-scons-tests ${platform} ${test_setup}
2884 }
2885
2886 test-scons-pic-common () {
2887 local platform=$1
2888 shift
2889 scons-clean-pnacl-pic-build-dir ${platform}
2890
2891 test_setup=$(scons-determine-tests "$@")
2892 run-scons-tests ${platform} ${test_setup} nacl_pic=1
2893 }
2894
2895 #@ test-arm - run arm tests via pnacl toolchain
2896 #@ test-arm <test> - run a single arm test via pnacl toolchain
2897 test-arm() {
2898 test-scons-common arm "$@"
2899 }
2900
2901 #@ test-x86-32 - run x86-32 tests via pnacl toolchain
2902 #@ test-x86-32 <test> - run a single x86-32 test via pnacl toolchain
2903 test-x86-32() {
2904 test-scons-common x86-32 "$@"
2905 }
2906
2907 #@ test-x86-64 - run all x86-64 tests via pnacl toolchain
2908 #@ test-x86-64 <test> - run a single x86-64 test via pnacl toolchain
2909 test-x86-64() {
2910 test-scons-common x86-64 "$@"
2911 }
2912
2913 #@ test-arm-pic - run all arm pic tests via pnacl toolchain
2914 #@ test-arm-pic <test> - run a single arm pic test via pnacl toolchain
2915 test-arm-pic() {
2916 test-scons-pic-common arm "$@"
2917 }
2918
2919 #@ test-x86-32-pic - run all x86-32 pic tests via pnacl toolchain
2920 #@ test-x86-32-pic <test> - run a single x86-32 pic test via pnacl toolchain
2921 test-x86-32-pic() {
2922 test-scons-pic-common x86-32 "$@"
2923 }
2924
2925 #@ test-x86-64-pic - run all x86-64 pic tests via pnacl toolchain
2926 #@ test-x86-64-pic <test> - run a single x86-64 pic test via pnacl toolchain
2927 test-x86-64-pic() {
2928 test-scons-pic-common x86-64 "$@"
2929 }
2930
2931 #@ test-all - run arm, x86-32, and x86-64 tests. (all should pass)
2932 #@ test-all <test> - run a single test on all architectures.
2933 test-all() {
2934 if [ $# -eq 1 ] && [ "$1" == "-k" ]; then
2935 echo "Using -k on test-all is not a good idea."
2936 exit -1
2937 fi
2938
2939 test-arm "$@"
2940 test-arm-pic "$@"
2941 test-x86-64 "$@"
2942 test-x86-64-pic "$@"
2943 test-x86-32 "$@"
2944 test-x86-32-pic "$@"
2945 }
2946
2947
2948 #@ test-spec <official-spec-dir> <setup> [ref|train] [<benchmarks>]*
2949 #@ - run spec tests
2950 #@
2951 test-spec() {
2952 if [[ $# -lt 2 ]]; then
2953 echo "not enough arguments for test-spec"
2954 exit 1
2955 fi;
2956 official=$(GetAbsolutePath $1)
2957 setup=$2
2958 shift 2
2959 spushd tests/spec2k
2960 ./run_all.sh CleanBenchmarks "$@"
2961 ./run_all.sh PopulateFromSpecHarness ${official} "$@"
2962 ./run_all.sh BuildAndRunBenchmarks ${setup} "$@"
2963 spopd
2964 }
2965
2966 #@ CollectTimingInfo <directory> <timing_result_file> <tagtype...>
2967 #@ CD's into the directory in a subshell and collects all the
2968 #@ relevant timed run info
2969 #@ tagtype just gets printed out.
2970 CollectTimingInfo() {
2971 wd=$1
2972 result_file=$2
2973 setup=$3
2974 (cd ${wd};
2975 mkdir -p $(dirname ${result_file})
2976 echo "##################################################" >>${result_file}
2977 date +"# Completed at %F %H:%M:%S %A ${result_file}" >> ${result_file}
2978 echo "# " ${wd}
2979 echo "#" $(uname -a) >> ${result_file}
2980 echo "# SETUP: ${setup}" >>${result_file}
2981 echo "##################################################" >>${result_file}
2982 echo "# COMPILE " >> ${result_file}
2983 for ff in $(find . -name "*.compile_time"); do
2984 cat ${ff} >> ${result_file}
2985 done
2986 echo "# RUN " >> ${result_file}
2987 for ff in $(find . -name "*.run_time"); do
2988 cat ${ff} >> ${result_file}
2989 done
2990 cat ${result_file}
2991 )
2992 }
2993
2994
2995 #@ timed-test-spec <result-file> <official-spec-dir> <setup> ... - run spec and
2996 #@ measure time / size data. Data is emitted to stdout, but also collected
2997 #@ in <result-file>. <result-file> is not cleared across runs (but temp files
2998 #@ are cleared on each run).
2999 #@ Note that the VERIFY variable effects the timing!
3000 timed-test-spec() {
3001 if ${BUILD_PLATFORM_MAC} ; then
3002 echo "Timed-test-spec is not currently supported on MacOS"
3003 exit -1
3004 fi
3005 if [ "$#" -lt "3" ]; then
3006 echo "timed-test-spec {result-file} {spec2krefdir} {setupfunc}" \
3007 "[ref|train] [benchmark]*"
3008 exit 1
3009 fi
3010 result_file=$1
3011 official=$(GetAbsolutePath $2)
3012 setup=$3
3013 shift 3
3014 spushd tests/spec2k
3015 ./run_all.sh CleanBenchmarks "$@"
3016 ./run_all.sh PopulateFromSpecHarness ${official} "$@"
3017 ./run_all.sh TimedBuildAndRunBenchmarks ${setup} "$@"
3018 CollectTimingInfo $(pwd) ${result_file} ${setup}
3019 spopd
3020 }
3021
3022
3023 #@ test-bot-base - tests that must pass on the bots to validate a TC
3024 test-bot-base() {
3025 test-all
3026 }
3027
3028 2778
3029 ###################################################################### 2779 ######################################################################
3030 ###################################################################### 2780 ######################################################################
3031 # 2781 #
3032 # UTILITIES 2782 # UTILITIES
3033 # 2783 #
3034 ###################################################################### 2784 ######################################################################
3035 ###################################################################### 2785 ######################################################################
3036 2786
3037 #@------------------------------------------------------------------------- 2787 #@-------------------------------------------------------------------------
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. 2967 [ $# = 0 ] && set -- help # Avoid reference to undefined $1.
3218 if [ "$(type -t $1)" != "function" ]; then 2968 if [ "$(type -t $1)" != "function" ]; then
3219 #Usage 2969 #Usage
3220 echo "ERROR: unknown function '$1'." >&2 2970 echo "ERROR: unknown function '$1'." >&2
3221 echo "For help, try:" 2971 echo "For help, try:"
3222 echo " $0 help" 2972 echo " $0 help"
3223 exit 1 2973 exit 1
3224 fi 2974 fi
3225 2975
3226 "$@" 2976 "$@"
OLDNEW
« no previous file with comments | « no previous file | tools/llvm/utman-test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698