add crossgen features. 43/142343/4
authorjang <jiseob.jang@samsung.com>
Thu, 3 Aug 2017 11:53:05 +0000 (20:53 +0900)
committerjang <jiseob.jang@samsung.com>
Fri, 4 Aug 2017 08:51:37 +0000 (17:51 +0900)
Change-Id: Ie6333d347114bd6a4cac09ab9111f41e7e49e87a
Signed-off-by: jang <jiseob.jang@samsung.com>
script/create_ni_files.sh [new file with mode: 0755]
script/get_clr_results.sh
script/invoked_create_ni_files.sh [new file with mode: 0755]

diff --git a/script/create_ni_files.sh b/script/create_ni_files.sh
new file mode 100755 (executable)
index 0000000..ded6c7d
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+usage()
+{
+    echo "Usage: $0 [device-name] --prefix-dir=### --overlay-dir=###"
+    echo "device-name - You can get the name by using 'sdb devices' command"
+    echo "--overlay-dir - You can specify the path of overlay"
+    echo "--environment  - You can specify the environment variable for performing the unittest"
+    echo "--options  - You can specify options for creating ni files"
+    exit 1
+}
+
+opt=""
+clrdir=""
+overlaydir=""
+environment=""
+options=""
+
+for i in "$@"
+do
+    if [ $# -le 0 ]; then
+        break
+    fi
+
+    case $i in
+    -h|--help)
+        usage
+        exit 1
+        ;;
+    --prefix-dir=*)
+        clrdir=${i#*=}
+        ;;
+    --overlay-dir=*)
+        overlaydir=${i#*=}
+        ;;
+    --environment=*)
+        environment=${i#*=}
+        ;;
+    --options=*)
+        options=${i#*=}
+        ;;
+    *)
+        opt="-s ${i#*}"
+        ;;
+    esac
+    shift
+done
+
+sdb ${opt} root on
+
+str=$( sdb ${opt} shell "uname -a" )
+if [[ $str == *"x86_64"* ]]; then
+    tcarch=x64
+elif [[ $str == *"armv7l"* ]]; then
+    tcarch=x86
+else
+    echo "not support target $str"
+    exit 1
+fi
+
+sdb ${opt} pull /etc/info.ini .
+version=$(awk -F "=" '/Build/ {print $2}' ./info.ini)
+version=${version%?}
+rm -rf ./info.ini
+
+if [[ ${clrdir} == "" ]]; then
+    clrdir="/opt/usr/coreclr-tc"
+fi
+
+if [[ ${overlaydir} == "" ]]; then
+    overlaydir="${clrdir}/Windows_NT.${tcarch}.Release/Tests/coreoverlay"
+fi
+
+sdb ${opt} push invoked_create_ni_files.sh $clrdir
+cmd="rm ${overlaydir}/*.ni.dll"
+echo ${cmd}
+sdb ${opt} shell ${cmd}
+cmd="cd ${clrdir} && \
+        ./invoked_create_ni_files.sh --overlay-dir=\"${overlaydir}\" --environment=\"${environment}\" \
+        --options=\"${options}\" >> crossgen.log 2>&1 | tee -a crossgen.log"
+echo ${cmd}
+sdb ${opt} shell ${cmd}
+
+sdb ${opt} shell "cd $clrdir && \
+        mkdir -p overlay && cp ${overlaydir}/* overlay \
+        && tar zcvf overlay_with_ni.tgz overlay \
+        && rm -rf overlay"
index 3acbb28..b5f3d76 100755 (executable)
@@ -64,3 +64,7 @@ if [ -f $name.xml ]; then
     ./generate_clr_csv $name.xml
 fi
 
+# Get results of creating ni
+sdb ${opt} pull $clrdir/crossgen_list.txt ./
+sdb ${opt} pull $clrdir/crossgen.log ./
+sdb ${opt} pull $clrdir/overlay_with_ni.tgz ./
diff --git a/script/invoked_create_ni_files.sh b/script/invoked_create_ni_files.sh
new file mode 100755 (executable)
index 0000000..28a47c2
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+usage()
+{
+    echo "Usage: $0 --overlay-dir=[name] --environment=[environment] --options=[options]"
+    echo "--overlay-dir  - You can specify the overlay directory for creating ni files"
+    echo "--environment  - You can specify the environment variable for creating ni files"
+    echo "--options  - You can specify options for creating ni files"
+    exit 1
+}
+
+overlaydir=""
+environment=""
+options="-readytorun"
+
+for i in "$@"
+do
+    if [ $# -le 0 ]; then
+        break
+    fi
+
+    case $i in
+    -h|--help)
+        usage
+        exit 1
+        ;;
+    --overlay-dir=*)
+        overlaydir=${i#*=}
+        ;;
+    --environment=*)
+        environment=${i#*=}
+        ;;
+    --options=*)
+        options=${i#*=}
+        ;;
+
+    *)
+        usage
+        exit 1
+        ;;
+    esac
+    shift
+done
+
+rm ${overlaydir}/*.ni.dll
+
+echo "environment: ${environment}"
+for word in ${environment}; do
+    export ${word}
+done
+
+
+echo "overlay-dir: ${overlaydir}"
+echo "" > crossgen_list.txt
+echo "============================================ crossgen start ============================================"
+echo "DLL NAME: System.Private.CoreLib.dll"
+"${overlaydir}"/crossgen ${options} -platform_assemblies_paths "${overlaydir}" -out "${overlaydir}/System.Private.CoreLib.ni.dll" "${overlaydir}/System.Private.CoreLib.dll"
+if [[ $? -ne 0 ]]; then
+    STATE="Fail"
+else
+    STATE="Pass"
+fi
+mv ${overlaydir}/System.Private.CoreLib.ni.dll ${overlaydir}/System.Private.CoreLib.dll
+echo "========================================================================================================"
+echo ""
+echo "System.Private.CoreLib.dll, ${STATE}" >> crossgen_list.txt
+
+for DLL_FILE in `find "${overlaydir}" -iname "*.dll" ! -iname "*.ni.dll"`; do
+    DLL_NAME=$(basename ${DLL_FILE})
+    OUT_NAME=$(echo ${DLL_NAME} | sed "s/.dll$/.ni.dll/g")
+
+    if [[ ${DLL_NAME} == "System.Private.CoreLib.dll" ]]; then
+        continue
+    fi
+
+    echo ""
+    echo "============================================ crossgen start ============================================"
+    echo "DLL NAME: ${DLL_NAME}"
+    "${overlaydir}"/crossgen ${options} -platform_assemblies_paths "${overlaydir}" -out "${overlaydir}/${OUT_NAME}" "${DLL_FILE}"
+    if [[ $? -ne 0 ]]; then
+        STATE="Fail"
+    else
+        STATE="Pass"
+    fi
+    echo "========================================================================================================"
+    echo ""
+    echo "${DLL_NAME}, ${STATE}" >> crossgen_list.txt
+done
+