Changeset 105 for trunk/IPs/systemC/processor/Morpheo/Script/SelfTest.sh
- Timestamp:
- Feb 5, 2009, 12:18:31 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Script/SelfTest.sh
r88 r105 114 114 function usage () 115 115 { 116 echo "Usage : ${0} action";117 echo "Arguments : ";116 echo "Usage : ${0} action"; 117 echo "Arguments : "; 118 118 echo " * action"; 119 echo " * test : test all component"; 120 echo ' for each component, create file in ${MORPHEO_HOME}/tmp/'; 121 echo " * test_all : same as test, but don't stop at the first error"; 122 echo " * res : list test's resultat"; 123 echo " * list : list test's resultat"; 124 echo " * clean : erase file in ${MORPHEO_HOME}/tmp/ directory"; 125 echo " * clean_all : clean all component"; 126 echo " * help : print this message"; 119 echo " * systemc : test all model systemC"; 120 echo ' for each component, create file in ${MORPHEO_HOME}/tmp/'; 121 echo " * systemc_all : same as test, but don't stop at the first error"; 122 echo " * vhdl : test all model VHDL"; 123 echo ' for each component, create file in ${MORPHEO_HOME}/tmp/'; 124 echo " * vhdl_all : same as test, but don't stop at the first error"; 125 echo " * result : list test's resultat"; 126 echo " * list : list test"; 127 echo " * clean : erase file in ${MORPHEO_HOME}/tmp/ directory"; 128 echo " * clean_all : clean all component"; 129 echo " * help : print this message"; 127 130 echo ""; 128 echo "Notes : ";131 echo "Notes : "; 129 132 echo " * Morpheo environment must be positionned"; 130 133 exit; 134 } 135 136 #-----[ simulation ]---------------------------------------- 137 # arg1 : cmd (execute / sim) 138 # arg2 : all (stop) 139 # arg3 : file suffix 140 function simulation () 141 { 142 pwd=${PWD}; 143 144 nb_cpu=$(cat /proc/cpuinfo |grep -c processor); 145 146 for i in ${directory[@]}; do 147 component=$(basename ${i}); 148 dir="${path}/${i}/SelfTest"; 149 150 if test -d "${dir}"; then 151 # have previous test ok ? 152 declare -i make_test=1; 153 154 file="${tmp}/${component}.${3}" 155 156 if test -f ${file}; then 157 res_test=$(cat ${file}); 158 if test "${test_ok}" = "${res_test}"; then 159 make_test=0; 160 fi; 161 fi; 162 163 if test ${make_test} -eq 1; then 164 cd ${dir}; 165 make config; 166 make -j${nb_cpu} ${1}; 167 case ${?} in 168 "0") 169 echo ${test_ok} > ${file}; 170 ;; 171 *) 172 173 echo ${test_ko} > ${file}; 174 echo ""; 175 echo "${component} : ${test_ko}"; 176 echo ""; 177 if test ${2} = "1"; then 178 exit 1; 179 fi; 180 ;; 181 esac; 182 make clean; 183 fi; 184 else 185 echo "${component} have not SelfTest directory."; 186 fi; 187 188 cd ${pwd}; 189 done; 131 190 } 132 191 … … 139 198 fi; 140 199 141 if test -z ${MORPHEO_TOPLEVEL}; then200 if test -z "${MORPHEO_TOPLEVEL}"; then 142 201 usage ${*}; 143 202 fi; … … 147 206 fi; 148 207 149 nb_cpu=$(cat /proc/cpuinfo |grep -c processor);150 pwd=${PWD};151 208 case ${1} in 152 "test" | "test_all") 153 for i in ${directory[@]}; do 154 component=$(basename ${i}); 155 dir="${path}/${i}/SelfTest"; 156 157 if test -d "${dir}"; then 158 # have previous test ok ? 159 declare -i make_test=1; 160 161 if test -f ${tmp}/${component}; then 162 res_test=$(cat ${tmp}/${component}); 163 if test "${test_ok}" = "${res_test}"; then 164 make_test=0; 165 fi; 209 "systemc" ) 210 simulation "execute" "1" "systemc"; 211 ;; 212 213 "systemc_all") 214 simulation "execute" "0" "systemc"; 215 ;; 216 217 "vhdl" ) 218 simulation "sim" "1" "vhdl"; 219 ;; 220 221 "vhdl_all") 222 simulation "sim" "0" "vhdl"; 223 ;; 224 225 "result") 226 for x in "systemc" "vhdl"; do 227 echo "${x}"; 228 for i in ${tmp}/*.${x}; do 229 if test -f ${i}; then 230 component=$(basename ${i} .${x}); 231 res_test=$(cat ${i}); 232 233 case "${res_test}" in 234 "${test_ok}") color=32; 235 ;; 236 "${test_ko}") color=31; 237 ;; 238 *) color=39; 239 ;; 240 esac 241 echo "[1;${color}m * ${res_test} - ${component}[1;0m"; 166 242 fi; 167 168 if test ${make_test} -eq 1; then 169 cd ${dir}; 170 make config; 171 make -j${nb_cpu} execute; 172 case ${?} in 173 "0") 174 echo ${test_ok} > ${tmp}/"${component}"; 175 ;; 176 *) 177 178 echo ${test_ko} > ${tmp}/"${component}"; 179 echo ""; 180 echo "${component} : ${test_ko}"; 181 echo ""; 182 if test ${1} = "test"; then 183 exit 1; 184 fi; 185 ;; 186 esac; 187 fi; 188 else 189 echo "${component} have not SelfTest directory."; 190 fi; 191 192 cd ${pwd}; 193 done; 194 ;; 195 196 "res") 197 for i in ${tmp}/*; do 198 if test -f ${i}; then 199 component=$(basename ${i}); 200 res_test=$(cat ${i}); 201 202 203 case "${res_test}" in 204 "${test_ok}") color=32; 205 ;; 206 "${test_ko}") color=31; 207 ;; 208 *) color=39; 209 ;; 210 esac 211 echo "[1;${color}m${res_test} - ${component}[1;0m"; 212 fi; 213 done; 214 ;; 243 done; 244 done; 245 ;; 246 215 247 216 248 "list") … … 226 258 227 259 "clean_all") 260 pwd=${PWD}; 261 228 262 for i in ${directory[@]}; do 229 263 component=$(basename ${i});
Note: See TracChangeset
for help on using the changeset viewer.