Add scripts for UnitTest
authorJiyoung Yun <jy910.yun@samsung.com>
Thu, 30 Mar 2017 10:57:40 +0000 (19:57 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Thu, 30 Mar 2017 10:57:40 +0000 (19:57 +0900)
Change-Id: I05a1c215d212b154f502c3a675532c8f19c95985

install.sh [new file with mode: 0755]
rpms/perl-5.20.0-3.57.armv7l.rpm [new file with mode: 0644]
rpms/perl-5.20.0-3.78.x86_64.rpm [new file with mode: 0644]
run.sh [new file with mode: 0755]
script/generate_clr_csv [new file with mode: 0755]
script/get_clr_results.sh [new file with mode: 0755]

diff --git a/install.sh b/install.sh
new file mode 100755 (executable)
index 0000000..c9c3f22
--- /dev/null
@@ -0,0 +1,155 @@
+#!/bin/bash
+
+user=
+password=
+
+usage()
+{
+    echo "Usage: $0 --device=[name] --target=[mobile|tv] --version=[version] --skiprpminstall"
+    echo "--device    - If there are more than one target,"
+    echo "              you should pass the device name by using 'sdb devices' command"
+    echo "--target    - Target device type (i.e. mobile, tv)"
+    echo "--version   - You can add the specific binary version name."
+    echo "              The name should can be found under http://165.213.149.200/download/public_mirror/tizen/"
+    echo "              like tizen-mobile_20170215.2."
+    echo "              Default is a latest repository."
+    echo "--skiprpminstall - Do not install rpm files"
+    exit 1
+}
+
+repo_url="http://165.213.149.200/download/public_mirror/tizen"
+
+arm_pkgs="target-TM1/packages/armv7l/"
+x86_64_pkgs="emulator64-wayland/packages/x86_64/"
+
+check_valid_url()
+{
+    status=$( curl -u $user:$password -s --head -w %{http_code} $1 -o /dev/null )
+    if [[ $status != 200 ]]; then
+        echo "Invalid webpage. (url=$1)"
+        exit 1
+    fi
+}
+
+opt="-d"
+devicetype=
+version="latest"
+skipinstall=0
+
+for i in "$@"
+do
+    if [ $# -le 0 ]; then
+        break
+    fi
+
+    case $i in
+        -h|--help)
+            usage
+            exit 1
+            ;;
+        --device=*)
+            opt="-s "${i#*=}
+            ;;
+        --target=*)
+            devicetype=${i#*=}
+            ;;
+        --version=*)
+            version=${i#*=}
+            ;;
+        --skiprpminstall)
+            skiprpminstall=1
+            ;;
+        *)
+            usage
+            exit 1
+            ;;
+    esac
+    shift
+done
+
+clrdir="/opt/usr/coreclr-tc"
+
+sdb ${opt} root on
+
+if [ $? != 0 ]; then
+       exit 1
+fi
+
+str=$( sdb ${opt} shell "uname -a" )
+if [[ $str == *"x86_64"* ]]; then
+    target=x86_64
+    tcarch=x64
+    pkg=$x86_64_pkgs
+elif [[ $str == *"armv7l"* ]]; then
+    target=armv7l
+    tcarch=x86
+    pkg=$arm_pkgs
+else
+    echo "not support target $str"
+    exit 1
+fi
+
+sdb ${opt} shell rm -rf $clrdir
+sdb ${opt} shell mkdir -p ${clrdir}
+
+if [ $skiprpminstall == 0 ]; then
+    echo "Target arch : ${target}"
+    echo "Check valid repository url"
+    url=$repo_url"/"$devicetype"/"$version"/repos/"$pkg
+    check_valid_url $url
+
+    echo -e " \n\n---- Donwload coreclr-test-*.rpm ----"
+    wget -r --no-parent -nd -R 'index.html*' -R '*debug*' -P rpms -A 'coreclr-test-*.rpm' $url --http-user=$user --http-password=$password
+
+    echo -e "\n\n---- Install rpm files ----"
+    tmpdir="$clrdir/tmp"
+    sdb ${opt} shell mkdir -p $tmpdir
+    sdb ${opt} push rpms/*.${target}.rpm $tmpdir
+    sdb ${opt} shell rpm -ivh --force $tmpdir/*.rpm
+    sdb ${opt} shell rm -rf $tmpdir
+    rm -rf rpms/coreclr-test-*.rpm
+fi
+
+echo -e "\n\n---- Download CoreCLR TC ----"
+tc_url="http://10.113.63.27:8080/job/CLR/job/"$tcarch"_Rel_CLEARED_TC_Pri2/lastSuccessfulBuild/artifact/output/testcases.bin.tgz"
+wget $tc_url
+
+echo -e "\n\n---- Install CoreCLR TC ----"
+sdb ${opt} push testcases.bin.tgz $clrdir
+sdb ${opt} shell mkdir -p $clrdir/Windows_NT.${tcarch}.Release
+sdb ${opt} shell tar xvzf $clrdir/testcases.bin.tgz -C $clrdir/Windows_NT.${tcarch}.Release
+sdb ${opt} shell rm $clrdir/testcases.bin.tgz
+rm testcases.bin.tgz
+
+echo -e "\n\n---- Checkout runtest.sh from master branch ----"
+git checkout tizen -- ./tests/runtest.sh
+git checkout tizen -- ./tests/tests*.txt
+git checkout tizen -- ./tests/setup-runtime-dependencies.sh
+sdb ${opt} push ./tests/* $clrdir
+rm -rf ./tests
+
+echo -e "\n\n---- Create TC Overlay ----"
+overlaydir="$clrdir/overlay"
+sdb ${opt} shell mkdir -p $overlaydir
+sdb ${opt} shell cp -rf $clrdir/Windows_NT.${tcarch}.Release/Tests/Core_Root/* $overlaydir
+sdb ${opt} shell cp -L /usr/share/tizen.net/* $overlaydir
+sdb ${opt} shell cp -L /usr/share/dotnet.tizen/framework/* $overlaydir
+# runtest.sh does not consider link files so copy directly
+sdb ${opt} shell find /usr/share/dotnet.tizen/test/ -name "*.so" -exec cp {} $overlaydir \\\;
+sdb ${opt} shell chmod 644 $overlaydir/*.dll $overlaydir/*.so
+
+sdb ${opt} shell sync
+
+echo -e "\n\n---- Finish ----"
+echo -e "CoreOverlay dir : $overlaydir"
+echo -e "How to run CoreCLR TC : "
+echo -e "# cd $clrdir"
+echo -e "# ./runtest.sh --testRootDir=$clrdir/Windows_NT.${tcarch}.Release \\"
+echo -e "> --testNativeBinDir=/usr/share/dotnet.tizen/test \\"
+echo -e "> --coreOverlayDir=$overlaydir -v --show-time | tee clr.log"
+echo -e "Output results : $clrdir/Windows_NT.${tcarch}.Release/coreclrtests.xml"
+echo -e "(You can use run.sh file in your host machine.)"
+echo -e "\nHow to convert useful csv file : "
+echo -e "(In host machine, not target)"
+echo -e "coreclr$ cd script"
+echo -e "coreclr/script$ ./get_clr_results.sh"
diff --git a/rpms/perl-5.20.0-3.57.armv7l.rpm b/rpms/perl-5.20.0-3.57.armv7l.rpm
new file mode 100644 (file)
index 0000000..090ea27
Binary files /dev/null and b/rpms/perl-5.20.0-3.57.armv7l.rpm differ
diff --git a/rpms/perl-5.20.0-3.78.x86_64.rpm b/rpms/perl-5.20.0-3.78.x86_64.rpm
new file mode 100644 (file)
index 0000000..2472b46
Binary files /dev/null and b/rpms/perl-5.20.0-3.78.x86_64.rpm differ
diff --git a/run.sh b/run.sh
new file mode 100755 (executable)
index 0000000..93baaf1
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+usage()
+{
+    echo "Usage: $0 --device=[name]"
+    echo "--device - You can get the name by using 'sdb devices' command"
+    exit 1
+}
+
+opt="-d"
+for i in "$@"
+do
+    if [ $# -le 0 ]; then
+        break
+    fi
+
+    case $i in
+    -h|--help)
+        usage
+        exit 1
+        ;;
+    --device=*)
+        opt="-s ${i#*}"
+        ;;
+    *)
+        usage
+        exit 1
+        ;;
+    esac
+    shift
+done
+
+clrdir="/opt/usr/coreclr-tc"
+overlaydir="$clrdir/overlay"
+
+sdb ${opt} root on
+
+if [ $? != 0 ]; then
+       exit 1
+fi
+
+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} shell "cd $clrdir && \
+        ./runtest.sh \
+        --testRootDir=$clrdir/Windows_NT.${tcarch}.Release \
+        --testNativeBinDir=/usr/share/dotnet.tizen/test \
+        --coreOverlayDir=$overlaydir | tee clr.log"
+
diff --git a/script/generate_clr_csv b/script/generate_clr_csv
new file mode 100755 (executable)
index 0000000..973dc81
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+
+#
+# USAGE: ./generate_clr_csv [XML FILE]
+#
+require 'nokogiri'
+require 'csv'
+
+input = ARGV[0]
+output = File.basename(input, File.extname(input)).concat(".csv")
+puts "Output : #{output}"
+
+@doc = Nokogiri::XML( File.open(input) )
+
+CSV.open(output, "w") do |csv|
+    csv << ["TYPE", "TYPE1", "TYPE2", "TYPE3", "METHOD", "RESULT"]
+    @doc.xpath("//test").each do |test|
+        types = test['type'].split(".")
+        csv << Array.new(4){types.shift} +  [test['method'], test['result']]
+    end
+end
diff --git a/script/get_clr_results.sh b/script/get_clr_results.sh
new file mode 100755 (executable)
index 0000000..568fd61
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+usage()
+{
+    echo "Usage: $0 [device-name] --postfix=###"
+    echo "device-name - You can get the name by using 'sdb devices' command"
+    exit 1
+}
+
+opt="-d"
+postfix=''
+
+for i in "$@"
+do
+    if [ $# -le 0 ]; then
+        break
+    fi
+
+    case $i in
+    -h|--help)
+        usage
+        exit 1
+        ;;
+    --postfix=*)
+        postfix="_"${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
+
+clrdir="/opt/usr/coreclr-tc"
+name="CoreCLR_UnitTest_Results_"$version$postfix
+
+sdb ${opt} pull $clrdir/Windows_NT.${tcarch}.Release/coreclrtests.xml $name.xml
+sdb ${opt} pull $clrdir/clr.log $name.log
+
+if [ -f $name.xml ]; then
+    ./generate_clr_csv $name.xml
+fi
+