]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/unit_tests/build_tests.sh
9 echo "[TEST] ${testname} "
10 if [ -x "./${testname}" ]
12 echo "[BEGIN] Executing test ${testname}"
13 out_str
=$(./"${testname}" 2>&1)
16 echo "[FAIL] Failed to execute test with name ${testname}"
20 if [ "${out_status}" == "0" ]
22 echo "[PASS] Successfully finished ${testname}"
25 echo "[FAIL] Test failed ${testname} exit value $out_status"
26 echo " *** FAILURE of test ${testname} *** "
32 function build_test
(){
37 echo "[MAKE] Building test ${testtarget}"
38 out_str
=$(make ${MAKE_ARGS} ${testtarget} 2>&1)
40 echo ${out_str} >> ${BUILD_LOG_FILEMAME}
42 if [ "${out_status}" == "0" ]
44 echo "[PASS][BUILD] Successfully built ${testtarget}"
47 echo "[FAIL][BUILD] Failed to build ${testtarget}"
56 TARGET_LIST_FILE
="xnu_target_executables.list"
57 BUILD_DIR
="${PWD}/BUILD/"
58 BUILD_LOG_FILEMAME
="${BUILD_DIR}/build_${TIMESTAMP}.log"
60 # load the list of targets to build/run
61 if [ -f "$TARGET_LIST_FILE" ]
63 TARGET_NAMES
=`cat $TARGET_LIST_FILE`
65 TARGET_NAMES
=`make ${MAKE_ARGS} list_targets`
68 if [ "$CMD" == "build" ]
71 # setup make arguments based on target requirements
72 if [ "${TARGET_MODE}" == "embedded" ]
74 T_ios
=`/usr/bin/xcodebuild -sdk iphoneos.internal -version Path`
75 T_ios_name
=iphoneos.internal
78 T_ios
=`/usr/bin/xcodebuild -sdk iphoneos -version Path`
84 echo "No iOS SDK found. Exiting."
88 MAKE_ARGS
="SDKROOT=${T_ios_name}"
89 elif [ "${TARGET_MODE}" == "desktop" ]
93 echo "Usage: ${PROGNAME} <desktop|embedded>"
97 if [ -d "${BUILD_DIR}" ]
103 echo "=========== Building XNU Unit Tests ========="
106 for testname_target
in ${TARGET_NAMES}
108 build_test
${makefilename} ${testname_target}
112 echo "Finished building tests. Saving list of targets in ${BUILD_DIR}/dst/${TARGET_LIST_FILE}"
113 echo "${TARGET_NAMES}" > ${BUILD_DIR}/dst
/${TARGET_LIST_FILE}
114 cat "${PROGNAME}" | sed s
/^CMD
=build
/CMD
=run
/g
> ${BUILD_DIR}/dst
/run_tests.sh
115 chmod +x
${BUILD_DIR}/dst
/run_tests.sh
116 echo "Generated ${BUILD_DIR}/dst/run_tests.sh for running the tests."
120 # End of Build action
123 if [ "$CMD" == "run" ]
126 echo "=========== Running XNU Unit Tests ========="
128 for testname_target
in ${TARGET_NAMES}
130 run_test
${testname_target}