[action] add test-fastmodel
authorYelin Jeong <yelini.jeong@samsung.com>
Tue, 11 Apr 2023 02:31:23 +0000 (11:31 +0900)
committer추지호/SoC Architecture팀(SR)/삼성전자 <jiho.chu@samsung.com>
Fri, 28 Apr 2023 06:05:32 +0000 (15:05 +0900)
This patch adds github action fastmodel.
pr-build : unittests and apptests except apptest-bulk
daily-build : all tests

Signed-off-by: Yelin Jeong <yelini.jeong@samsung.com>
.github/actions/test-fastmodel/action.yml
.github/workflows/pr-build-aarch64.yml
.github/workflows/upload-package-aarch64.yml
utils/trinity_test/check.sh
utils/trinity_test/connect_kernel.exp [new file with mode: 0644]
utils/trinity_test/load_modules.sh [deleted file]
utils/trinity_test/refresh.sh

index bb9ed8366955c280cca359f7ecf8e4dd0cbcf086..a8d96271caf8b41e0f276df3a17e808d97e8f270 100644 (file)
@@ -6,9 +6,9 @@ inputs:
     description: path of RPM packages
     required: true
     default: /tmp/rpms
-  run_apptest:
-    description: run apptest
-    required: false
+  test_type:
+    description: fast test or full test
+    required: true
     type: string
   art_id:
     description: artifactory id
@@ -27,17 +27,26 @@ runs:
       shell: bash
     # Download latest npu kernel
     - run: |
-        wget -r -np -nH --cut-dirs=5 https://bart.sec.samsung.net/artifactory/aip-generic-local/NPU_LinuxKernel/latest/aarch64/ --user ${{ inputs.art_id }} --password ${{ inputs.art_pw }}
+        wget -r -np -nH --cut-dirs=5 https://bart.sec.samsung.net/artifactory/aip-rpm-local/NPU_LinuxKernel/ --user ${{ inputs.art_id }} --password ${{ inputs.art_pw }}
         mv *.rpm /opt/trinity/share/RPMS
       shell: bash
     # Set up test environment
     - run: |
         service ssh start
         service ssh status
-        export ARMLMD_LICENSE_FILE=8224@10.113.242.30
-        su www-data --command /opt/trinity/run_taos &
+        cp $GITHUB_WORKSPACE/utils/trinity_test/check.sh /opt/trinity/share/check.sh
+        cp $GITHUB_WORKSPACE/utils/trinity_test/refresh.sh /opt/trinity/share/refresh.sh
+        cp $GITHUB_WORKSPACE/utils/trinity_test/connect_kernel.exp /opt/trinity/connect_kernel.exp
         sed -i -e "s/\[IP]/$(hostname -i)/g" /opt/trinity/connect_kernel.exp
-        sed -i -e "s/\[APPTEST]/${{ inputs.run_apptest }}/g" /opt/trinity/connect_kernel.exp
+        sed -i -e "s/\[TEST]/${{ inputs.test_type }}/g" /opt/trinity/connect_kernel.exp
+        chmod a+x /opt/trinity/connect_kernel.exp
+      shell: bash
+    # Test TRIV 2.4
+    - run: |
+        export ARMLMD_LICENSE_FILE=8224@10.113.242.30
+        su www-data --command "/opt/trinity/run_taos 2.4 &"
         sleep 20
-        su www-data --command /opt/trinity/connect_kernel.exp
+        su www-data --command "/opt/trinity/connect_kernel.exp"
       shell: bash
+
+    # TODO : Check TRIV 2.3!
index c12657a30208484a0be24896e56dce87ec22d1ca..c13137e376a7c02458644dc9841175d701da941a 100644 (file)
@@ -16,7 +16,7 @@ jobs:
         username: ${{ secrets.BART_ID }}
         password: ${{ secrets.BART_PW }}
 
-    timeout-minutes: 30
+    timeout-minutes: 120
 
     steps:
       - name: Clone your repository
@@ -28,28 +28,30 @@ jobs:
         with:
           arch: aarch64
           output_path: /tmp/rpms
-      # - name: Fastmodel test
-      #   uses: ./.github/actions/test-fastmodel
-      #   with:
-      #     package_path: /tmp/rpms
-      #     art_id: ${{ secrets.BART_ID }}
-      #     art_pw: ${{ secrets.BART_PW }}
-      # - name: Upload test result
-      #   uses: CODE-Actions/upload-artifact@v2
-      #   with:
-      #     name: fastmodel test log
-      #     path: |
-      #       /opt/trinity/share/log/err.txt
-      #       /opt/trinity/share/log/out.txt
-      # - name: Check if apptest failed
-      #   run: |
-      #     echo $(cat /opt/trinity/share/log/result.txt)
-      #     if [[ "$(cat /opt/trinity/share/log/result.txt)" != 0 ]]; then
-      #       exit 1
-      #     fi
-      #   shell : bash
+      - name: Fastmodel test
+        uses: ./.github/actions/test-fastmodel
+        with:
+          package_path: /tmp/rpms
+          test_type: apptest
+          art_id: ${{ secrets.BART_ID }}
+          art_pw: ${{ secrets.BART_PW }}
+      - name: Upload test result
+        uses: CODE-Actions/upload-artifact@v2
+        with:
+          name: fastmodel test log
+          path: |
+            /opt/trinity/share/log/err.txt
+            /opt/trinity/share/log/out.txt
+            /opt/trinity/share/log/result.txt
       - name: Upload artifacts
         uses: CODE-Actions/upload-artifact@v2
         with:
           name: built-package
           path: /tmp/rpms
+      - name: Check if apptest failed
+        run: |
+          echo $(cat /opt/trinity/share/log/result.txt)
+          if [[ "$(cat /opt/trinity/share/log/result.txt)" != 0 ]]; then
+            exit 1
+          fi
+        shell : bash
index ee02006fc5f1374fbccf2ce1bbbee9bf11b18ff3..2ad8fc0b95705a3eec7accb0c37d69986d033627 100644 (file)
@@ -25,7 +25,7 @@ jobs:
         username: ${{ secrets.BART_ID }}
         password: ${{ secrets.BART_PW }}
 
-    timeout-minutes: 60
+    timeout-minutes: 180
 
     steps:
       - name: Get current date
@@ -38,6 +38,21 @@ jobs:
         with:
           arch: aarch64
           output_path: /tmp/rpms
+      - name: Fastmodel test
+        uses: ./.github/actions/test-fastmodel
+        with:
+          package_path: /tmp/rpms
+          test_type: apptest-bulk
+          art_id: ${{ secrets.BART_ID }}
+          art_pw: ${{ secrets.BART_PW }}
+      - name: Upload test result
+        uses: CODE-Actions/upload-artifact@v2
+        with:
+          name: fastmodel test log
+          path: |
+            /opt/trinity/share/log/err.txt
+            /opt/trinity/share/log/out.txt
+            /opt/trinity/share/log/result.txt
       - name: Upload artifacts
         uses: CODE-Actions/upload-artifact@v2
         with:
index 97d580d82a9621f1c7b7e9029c1dfbbc3b835643..3367b11a4c8649e08f4486be42b03463ee77984a 100755 (executable)
@@ -1,23 +1,25 @@
 #!/bin/sh
 
+TEST=$1
 RPM_PATH=/mnt/RPMS
 LOG_PATH=/mnt/log
 TEST_PATH=/usr/lib64/npu-engine/bin/
 DEVICE_PATH=/dev/triv2-0
-MODEL_PATH=/usr/share/npu-engine/testdata/TRIV238_2TOPS
+MODEL_PATH=/usr/share/npu-engine/testdata/TRIV242
 
 function check_exit() {
   echo "$1" > ${LOG_PATH}/result.txt
   sleep 1
-  exit
+  toybox rmmod trinity_vision2
+  toybox rmmod npu_sched
+  toybox poweroff
 }
 
 echo "" > ${LOG_PATH}/out.txt
 echo "" > ${LOG_PATH}/err.txt
 
 # Install npu-engine packages and modules.
-./mnt/trinity_test/load_modules.sh
-./mnt/trinity_test/refresh.sh 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+./mnt/refresh.sh 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
 
 # Check test directory
 if [ ! -d "$TEST_PATH" ]; then
@@ -47,35 +49,51 @@ find unittests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'
 done
 
 echo -e "\n[2/2] Checking AppTests..." >> ${LOG_PATH}/out.txt
-find apptests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' apptest_exec; do
- if [ ${apptest_exec} == "apptests/apptest_tvn_triv2_bulk" ]; then
-  echo -e "\n${apptest_exec} [TRIV238_2TOPS] is RUNNING" >> ${LOG_PATH}/out.txt
-  ./${apptest_exec} ${MODEL_PATH} 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_aging" ]; then
-  ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 1 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
-  ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 2 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
-  ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 3 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
-  ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 4 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_preempt" ]; then
-  ./${apptest_exec} ${MODEL_PATH}/ 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_interleave" ]; then
-  ./${apptest_exec} 10 ${MODEL_PATH}/MAX_POOL_2D_000,${MODEL_PATH}/CONV_2D_300 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_xml" ]; then
-  ./${apptest_exec} /mnt/trinity_test/model.xml 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_profile" ]; then
-  ./${apptest_exec} ${MODEL_PATH}/ADD_000 -p visa 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- else
-  ./${apptest_exec} ${MODEL_PATH}/ADD_000 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
- fi
+echo -e "\n AppTests type : $TEST" >> ${LOG_PATH}/out.txt
+if [[ $TEST == apptest* ]]; then
+  find apptests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' apptest_exec; do
+    if [ ${apptest_exec} == "apptests/apptest_tvn_triv2" ]; then
+      ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+    elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_aging" ]; then
+      ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 1 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+      ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 2 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+      ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 3 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+      ./${apptest_exec} ${MODEL_PATH}/CONV_2D_300 4 10 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+    elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_interleave" ]; then
+      ./${apptest_exec} 10 ${MODEL_PATH}/MAX_POOL_2D_000,${MODEL_PATH}/CONV_2D_300 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+    elif [ ${apptest_exec} == "apptests/apptest_tvn_triv2_profile" ]; then
+      ./${apptest_exec} ${MODEL_PATH}/ADD_000 -p visa 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+    else
+      echo -e "\n${apptest_exec} is SKIPPED" >> ${LOG_PATH}/out.txt
+    fi
+
+    result=$?
+    if [[ ${result} -ne 0 ]]; then
+      echo -e "${apptest_exec} is FAILED" >> ${LOG_PATH}/out.txt
+      check_exit $result
+      else
+        echo -e "${apptest_exec} is PASSED" >> ${LOG_PATH}/out.txt
+      fi
+  done
+fi
+
+if [[ $TEST == "apptest-bulk" ]]; then
+  find apptests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' apptest_exec; do
+    if [ ${apptest_exec} == "apptests/apptest_tvn_triv2_bulk" ]; then
+      echo -e "\n${apptest_exec} is RUNNING" >> ${LOG_PATH}/out.txt
+      ./${apptest_exec} ${MODEL_PATH} 1>> ${LOG_PATH}/out.txt 2>> ${LOG_PATH}/err.txt
+    fi
+
+    result=$?
+    if [[ ${result} -ne 0 ]]; then
+      echo -e "${apptest_exec} is FAILED" >> ${LOG_PATH}/out.txt
+      check_exit $result
+      else
+        echo -e "${apptest_exec} is PASSED" >> ${LOG_PATH}/out.txt
+      fi
+  done
+fi
 
- result=$?
- if [[ ${result} -ne 0 ]]; then
-  echo -e "${apptest_exec} is FAILED" >> ${LOG_PATH}/out.txt
-  check_exit $result
-  else
-    echo -e "${apptest_exec} is PASSED" >> ${LOG_PATH}/out.txt
-  fi
-done
 popd
 
 check_exit 0
diff --git a/utils/trinity_test/connect_kernel.exp b/utils/trinity_test/connect_kernel.exp
new file mode 100644 (file)
index 0000000..32f3f7a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/expect
+
+# wait until terminated
+set timeout -1
+
+# set npu version
+# set npu_ver [lindex $argv 0];
+
+spawn telnet localhost 5000
+sleep 20
+send "sshfs www-data@[IP]:/opt/trinity/share /mnt \r"
+sleep 10
+send "yes\r"
+sleep 10
+send "www-data\r"
+sleep 10
+send "./mnt/check.sh [TEST]\r"
+expect eof
diff --git a/utils/trinity_test/load_modules.sh b/utils/trinity_test/load_modules.sh
deleted file mode 100755 (executable)
index f5fbd15..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-pushd /mnt/modules
-
-toybox insmod npu_sched.ko
-toybox insmod trinity_vision2.ko
-mdev -s
-
-echo "2097152" > /sys/devices/platform/trinity/30410000.triv2/control/profile
-
-popd
index 84f19bcf6330e87d0fb3ba04f4ee964e70da32c7..2228be094f13110c561c73d01b686f577c405b05 100755 (executable)
@@ -2,6 +2,16 @@
 
 pushd /mnt/RPMS
 
-rpm -ivh --force npu-engine-*
+rpm -ivh --force --nodeps *
+
+popd
+
+pushd /lib/modules/4.12.0-arm64/kernel/drivers/misc
+
+insmod sdp_npu_sched/npu_sched.ko
+insmod trinity/trinity_vision2.ko
+mdev -s
+
+echo "2097152" > /sys/devices/platform/trinity/32010000.triv2/control/profile
 
 popd