Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / test_op_il_seq_point.sh
index 5df176e4755c968607feee268744df3ab860bb28..ee235f5c739cb4a91bb87edfe55e0b5bb5a14f3c 100755 (executable)
@@ -1,22 +1,28 @@
 #!/bin/bash
 
-TEST_FILE=$1
-USE_AOT=$2
+DEFAULT_PROFILE=$1
+TEST_FILE=$2
+USE_AOT=$3
 
 TMP_FILE_PREFIX=$(basename $0).tmp
 BASEDIR=$(dirname $0)
 
-MONO_PATH=$BASEDIR/../../mcs/class/lib/net_4_x:$BASEDIR
+case "$(uname -s)" in
+       CYGWIN*) PLATFORM_PATH_SEPARATOR=';';;
+       *) PLATFORM_PATH_SEPARATOR=':';;
+esac
+
+MONO_PATH=$BASEDIR/../../mcs/class/lib/$DEFAULT_PROFILE$PLATFORM_PATH_SEPARATOR$BASEDIR
 RUNTIME=$BASEDIR/../../runtime/mono-wrapper
 
 trap "rm -rf ${TMP_FILE_PREFIX}*" EXIT
 
 tmp_file () {
-       mktemp ./${TMP_FILE_PREFIX}XXXX
+       mktemp ./${TMP_FILE_PREFIX}XXXXXX
 }
 
 clean_aot () {
-       rm -rf *.exe..so *.exe.dylib *.exe.dylib.dSYM
+       rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM *.exe.dll
 }
 
 # The test compares the generated native code size between a compilation with and without seq points.
@@ -42,15 +48,19 @@ get_method () {
 }
 
 diff_methods () {
-       TMP_FILE=$(tmp_file)
-       echo "$(MONO_DEBUG=single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE
-       diff <(cat $TMP_FILE) <(echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_methods $1 $2 $3 $4)")
+       TMP_FILE1=$(tmp_file)
+       TMP_FILE2=$(tmp_file)
+       echo "$(MONO_DEBUG=no-compact-seq-points,single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE1
+       echo "$(MONO_DEBUG=single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE2
+       diff $TMP_FILE1 $TMP_FILE2
 }
 
 diff_method () {
-       TMP_FILE=$(tmp_file)
-       echo "$(MONO_DEBUG=single-imm-size get_method $1 $2 $3 $4 $5)" >$TMP_FILE
-       sdiff -w 150 <(cat $TMP_FILE) <(echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_method $1 $2 $3 $4 $5 | grep -Ev il_seq_point)")
+       TMP_FILE1=$(tmp_file)
+       TMP_FILE2=$(tmp_file)
+       echo "$(MONO_DEBUG=no-compact-seq-points,single-imm-size get_method $1 $2 $3 $4 $5)" >$TMP_FILE1
+       echo "$(MONO_DEBUG=single-imm-size get_method $1 $2 $3 $4 $5 | grep -Ev il_seq_point)" >$TMP_FILE2
+       sdiff -w 150 $TMP_FILE1 $TMP_FILE2
 }
 
 get_method_name () {
@@ -89,27 +99,29 @@ while read line; do
        fi
 done < $TMP_FILE
 
-echo -n "              <test-case name=\"MonoTests.op_il_seq_point.${TEST_FILE}${USE_AOT}\" executed=\"True\" time=\"0\" asserts=\"0\" success=\"" >> TestResults_op_il_seq_point.xml
+TESTRESULT_FILE=TestResult-op_il_seq_point.tmp
+
+echo -n "              <test-case name=\"MonoTests.op_il_seq_point.${TEST_FILE}${USE_AOT}\" executed=\"True\" time=\"0\" asserts=\"0\" success=\"" >> $TESTRESULT_FILE
 
 if [ $CHANGES != 0 ]
 then
        METHOD_NAME=$(get_method_name "$METHOD")
 
-       echo "False\">" >> TestResults_op_il_seq_point.xml
-       echo "                <failure>" >> TestResults_op_il_seq_point.xml
-       echo -n "                  <message><![CDATA[" >> TestResults_op_il_seq_point.xml
-       echo "Detected OP_IL_SEQ_POINT incompatibility on $TEST_FILE" >> TestResults_op_il_seq_point.xml
-       echo "  $CHANGES methods differ when sequence points are enabled." >> TestResults_op_il_seq_point.xml
-       echo '  This is probably caused by a runtime optimization that is not handling OP_IL_SEQ_POINT' >> TestResults_op_il_seq_point.xml
-       echo '' >> TestResults_op_il_seq_point.xml
-       echo "Diff $METHOD_NAME" >> TestResults_op_il_seq_point.xml
-       echo "Without IL_OP_SEQ_POINT                                                         With IL_OP_SEQ_POINT" >> TestResults_op_il_seq_point.xml
-       echo -n "$(diff_method $MONO_PATH $RUNTIME $TEST_FILE $METHOD_NAME $USE_AOT)" >> TestResults_op_il_seq_point.xml
-       echo "]]></message>" >> TestResults_op_il_seq_point.xml
-       echo "                  <stack-trace>" >> TestResults_op_il_seq_point.xml
-       echo "                  </stack-trace>" >> TestResults_op_il_seq_point.xml
-       echo "                </failure>" >> TestResults_op_il_seq_point.xml
-       echo "              </test-case>" >> TestResults_op_il_seq_point.xml
+       echo "False\">" >> $TESTRESULT_FILE
+       echo "                <failure>" >> $TESTRESULT_FILE
+       echo -n "                  <message><![CDATA[" >> $TESTRESULT_FILE
+       echo "Detected OP_IL_SEQ_POINT incompatibility on $TEST_FILE" >> $TESTRESULT_FILE
+       echo "  $CHANGES methods differ when sequence points are enabled." >> $TESTRESULT_FILE
+       echo '  This is probably caused by a runtime optimization that is not handling OP_IL_SEQ_POINT' >> $TESTRESULT_FILE
+       echo '' >> $TESTRESULT_FILE
+       echo "Diff $METHOD_NAME" >> $TESTRESULT_FILE
+       echo "Without IL_OP_SEQ_POINT                                                         With IL_OP_SEQ_POINT" >> $TESTRESULT_FILE
+       echo -n "$(diff_method $MONO_PATH $RUNTIME $TEST_FILE $METHOD_NAME $USE_AOT)" >> $TESTRESULT_FILE
+       echo "]]></message>" >> $TESTRESULT_FILE
+       echo "                  <stack-trace>" >> $TESTRESULT_FILE
+       echo "                  </stack-trace>" >> $TESTRESULT_FILE
+       echo "                </failure>" >> $TESTRESULT_FILE
+       echo "              </test-case>" >> $TESTRESULT_FILE
 
        echo ''
        echo "Detected OP_IL_SEQ_POINT incompatibility on $TEST_FILE"
@@ -122,5 +134,5 @@ then
        echo "$(diff_method $MONO_PATH $RUNTIME $TEST_FILE $METHOD_NAME $USE_AOT)"
        exit 1
 else
-       echo "True\" />" >> TestResults_op_il_seq_point.xml
+       echo "True\" />" >> $TESTRESULT_FILE
 fi