From 4dc96f09b676cb16543718c31277e88dea65de90 Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Wed, 18 Nov 2020 18:21:44 +0300 Subject: [PATCH] Add Java tests (#8) --- .ci/azure/linux.yml | 185 ++++++++-------- .ci/azure/mac.yml | 185 ++++++++-------- .ci/azure/windows.yml | 203 +++++++++--------- modules/java_api/tests/CMakeLists.txt | 8 +- .../java_api/tests/OpenVinoTestRunner.java | 3 + 5 files changed, 316 insertions(+), 268 deletions(-) diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 7d6b23e99b2a87..66bcc0d23c5b72 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -1,84 +1,101 @@ -resources: - repositories: - - repository: openvino - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/openvino - -jobs: -- job: Lin - # About 150% of total time - timeoutInMinutes: 60 - - pool: - name: LIN_VMSS_VENV_F8S_WU2 - - variables: - system.debug: true - VSTS_HTTP_RETRY: 5 - VSTS_HTTP_TIMEOUT: 200 - WORKERS_NUMBER: 8 - BUILD_TYPE: Release - REPO_DIR: $(Build.Repository.LocalPath) - OPENVINO_REPO_DIR: $(REPO_DIR)/../openvino - WORK_DIR: $(Pipeline.Workspace)/_w - BUILD_DIR: $(WORK_DIR)/build - BIN_DIR: $(OPENVINO_REPO_DIR)/bin/intel64/$(BUILD_TYPE) - - steps: - - script: | - curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01" - whoami - uname -a - which python3 - python3 --version - which java - java -version - gcc --version - lsb_release - env - cat /proc/cpuinfo - cat /proc/meminfo - cat /etc/fstab - vmstat -s - df - lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd" - displayName: 'System info' - - - script: | - rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR) - rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR) - displayName: 'Make dir' - - - checkout: self - clean: true - lfs: false - submodules: recursive - path: openvino_contrib - - - checkout: openvino - clean: true - lfs: false - submodules: recursive - path: openvino - - - script: | - sudo apt --assume-yes install libusb-1.0-0-dev - # Speed up build - wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip - unzip ninja-linux.zip - sudo cp -v ninja /usr/local/bin/ - workingDirectory: $(WORK_DIR) - displayName: 'Install dependencies' - - - task: CMake@1 - inputs: - cmakeArgs: -GNinja -DVERBOSE_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_JAVA=OFF -DIE_EXTRA_MODULES=$(REPO_DIR)/modules $(OPENVINO_REPO_DIR) - workingDirectory: $(BUILD_DIR) - - - script: ninja - workingDirectory: $(BUILD_DIR) - displayName: 'Build Lin' - - - script: ls -alR $(OPENVINO_REPO_DIR)/bin/ - displayName: 'List files' +resources: + repositories: + - repository: openvino + type: github + endpoint: openvinotoolkit + name: openvinotoolkit/openvino + + - repository: testdata + type: github + endpoint: openvinotoolkit + name: openvinotoolkit/testdata + +jobs: +- job: Lin + # About 150% of total time + timeoutInMinutes: 60 + + pool: + name: LIN_VMSS_VENV_F8S_WU2 + + variables: + system.debug: true + VSTS_HTTP_RETRY: 5 + VSTS_HTTP_TIMEOUT: 200 + WORKERS_NUMBER: 8 + BUILD_TYPE: Release + REPO_DIR: $(Build.Repository.LocalPath) + OPENVINO_REPO_DIR: $(REPO_DIR)/../openvino + MODELS_PATH: $(REPO_DIR)/../testdata + WORK_DIR: $(Pipeline.Workspace)/_w + BUILD_DIR: $(WORK_DIR)/build + BIN_DIR: $(OPENVINO_REPO_DIR)/bin/intel64/$(BUILD_TYPE) + + steps: + - script: | + curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01" + whoami + uname -a + which python3 + python3 --version + which java + java -version + gcc --version + lsb_release + env + cat /proc/cpuinfo + cat /proc/meminfo + cat /etc/fstab + vmstat -s + df + lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd" + displayName: 'System info' + + - script: | + rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR) + rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR) + displayName: 'Make dir' + + - checkout: self + clean: true + lfs: false + submodules: recursive + path: openvino_contrib + + - checkout: openvino + clean: true + lfs: false + submodules: recursive + path: openvino + + - checkout: testdata + clean: true + lfs: true + path: testdata + + - script: | + sudo apt --assume-yes install libusb-1.0-0-dev + # Speed up build + wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip + unzip ninja-linux.zip + sudo cp -v ninja /usr/local/bin/ + workingDirectory: $(WORK_DIR) + displayName: 'Install dependencies' + + - task: CMake@1 + inputs: + cmakeArgs: -GNinja -DVERBOSE_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_JAVA=OFF -DENABLE_TESTS=ON -DIE_EXTRA_MODULES=$(REPO_DIR)/modules $(OPENVINO_REPO_DIR) + workingDirectory: $(BUILD_DIR) + + - script: ninja + workingDirectory: $(BUILD_DIR) + displayName: 'Build Lin' + + - script: ls -alR $(OPENVINO_REPO_DIR)/bin/ + displayName: 'List files' + + - script: java -cp "*" OpenVinoTestRunner + workingDirectory: $(BIN_DIR)/lib + env: + LD_LIBRARY_PATH: $(BIN_DIR)/lib + displayName: 'Java tests' diff --git a/.ci/azure/mac.yml b/.ci/azure/mac.yml index 90603905ef92dd..c621e94b3b469d 100644 --- a/.ci/azure/mac.yml +++ b/.ci/azure/mac.yml @@ -1,84 +1,101 @@ -resources: - repositories: - - repository: openvino - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/openvino - -jobs: -- job: Mac - # About 200% of total time (perfomace of Mac hosts is unstable) - timeoutInMinutes: 120 - - pool: - vmImage: 'macOS-10.15' - - variables: - system.debug: true - VSTS_HTTP_RETRY: 5 - VSTS_HTTP_TIMEOUT: 200 - WORKERS_NUMBER: 3 - BUILD_TYPE: Release - REPO_DIR: $(Build.Repository.LocalPath) - OPENVINO_REPO_DIR: $(REPO_DIR)/../openvino - WORK_DIR: $(Pipeline.Workspace)/_w - BUILD_DIR: $(WORK_DIR)/build - BIN_DIR: $(OPENVINO_REPO_DIR)/bin/intel64/$(BUILD_TYPE) - - steps: - - script: | - whoami - uname -a - which python3 - python3 --version - which java - java -version - gcc --version - xcrun --sdk macosx --show-sdk-version - env - sysctl -a - displayName: 'System info' - - - script: | - rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR) - rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR) - displayName: 'Make dir' - - - checkout: self - clean: true - lfs: false - submodules: recursive - path: openvino_contrib - - - checkout: openvino - clean: true - lfs: false - submodules: recursive - path: openvino - - - script: | - brew install cython - brew install automake - # Speed up build - brew install ninja - - workingDirectory: $(WORK_DIR) - displayName: 'Install dependencies' - - - script: | - export PATH="/usr/local/opt/cython/bin:$PATH" - export CC=gcc - export CXX=g++ - # Disable errors with Ninja - export CXXFLAGS="-Wno-error=unused-command-line-argument" - export CFLAGS="-Wno-error=unused-command-line-argument" - cmake -GNinja -DVERBOSE_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_JAVA=OFF -DIE_EXTRA_MODULES=$(REPO_DIR)/modules $(OPENVINO_REPO_DIR) - workingDirectory: $(BUILD_DIR) - displayName: 'CMake' - - - script: ninja - workingDirectory: $(BUILD_DIR) - displayName: 'Build Mac' - - - script: ls -alR $(OPENVINO_REPO_DIR)/bin/ - displayName: 'List files' +resources: + repositories: + - repository: openvino + type: github + endpoint: openvinotoolkit + name: openvinotoolkit/openvino + + - repository: testdata + type: github + endpoint: openvinotoolkit + name: openvinotoolkit/testdata + +jobs: +- job: Mac + # About 200% of total time (perfomace of Mac hosts is unstable) + timeoutInMinutes: 120 + + pool: + vmImage: 'macOS-10.15' + + variables: + system.debug: true + VSTS_HTTP_RETRY: 5 + VSTS_HTTP_TIMEOUT: 200 + WORKERS_NUMBER: 3 + BUILD_TYPE: Release + REPO_DIR: $(Build.Repository.LocalPath) + OPENVINO_REPO_DIR: $(REPO_DIR)/../openvino + MODELS_PATH: $(REPO_DIR)/../testdata + WORK_DIR: $(Pipeline.Workspace)/_w + BUILD_DIR: $(WORK_DIR)/build + BIN_DIR: $(OPENVINO_REPO_DIR)/bin/intel64/$(BUILD_TYPE) + + steps: + - script: | + whoami + uname -a + which python3 + python3 --version + which java + java -version + gcc --version + xcrun --sdk macosx --show-sdk-version + env + sysctl -a + displayName: 'System info' + + - script: | + rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR) + rm -rf $(BUILD_DIR) ; mkdir $(BUILD_DIR) + displayName: 'Make dir' + + - checkout: self + clean: true + lfs: false + submodules: recursive + path: openvino_contrib + + - checkout: openvino + clean: true + lfs: false + submodules: recursive + path: openvino + + - checkout: testdata + clean: true + lfs: true + path: testdata + + - script: | + brew install cython + brew install automake + # Speed up build + brew install ninja + + workingDirectory: $(WORK_DIR) + displayName: 'Install dependencies' + + - script: | + export PATH="/usr/local/opt/cython/bin:$PATH" + export CC=gcc + export CXX=g++ + # Disable errors with Ninja + export CXXFLAGS="-Wno-error=unused-command-line-argument" + export CFLAGS="-Wno-error=unused-command-line-argument" + cmake -GNinja -DVERBOSE_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_JAVA=OFF -DENABLE_TESTS=ON -DIE_EXTRA_MODULES=$(REPO_DIR)/modules $(OPENVINO_REPO_DIR) + workingDirectory: $(BUILD_DIR) + displayName: 'CMake' + + - script: ninja + workingDirectory: $(BUILD_DIR) + displayName: 'Build Mac' + + - script: ls -alR $(OPENVINO_REPO_DIR)/bin/ + displayName: 'List files' + + - script: java -cp "*" OpenVinoTestRunner + workingDirectory: $(BIN_DIR)/lib + env: + LD_LIBRARY_PATH: $(BIN_DIR)/lib + displayName: 'Java tests' diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index 971b78b5447b49..2fec7ed51f3e2b 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -1,96 +1,107 @@ -resources: - repositories: - - repository: openvino - type: github - endpoint: openvinotoolkit - name: openvinotoolkit/openvino - -jobs: -- job: Win - # About 150% of total time - timeoutInMinutes: 120 - - pool: - name: WIN_VMSS_VENV_F8S_WU2 - - variables: - system.debug: true - VSTS_HTTP_RETRY: 5 - VSTS_HTTP_TIMEOUT: 200 - WORKERS_NUMBER: 8 - BUILD_TYPE: Release - REPO_DIR: $(Build.Repository.LocalPath) - OPENVINO_REPO_DIR: $(REPO_DIR)\..\openvino - WORK_DIR: $(Pipeline.Workspace)\_w - BUILD_DIR: D:\build - BIN_DIR: $(OPENVINO_REPO_DIR)\bin\intel64 - MSVS_VARS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat - MSVC_COMPILER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe - - steps: - - script: | - powershell -command "Invoke-RestMethod -Headers @{\"Metadata\"=\"true\"} -Method GET -Uri http://169.254.169.254/metadata/instance/compute?api-version=2019-06-01 | format-custom" - where python3 - where python - python --version - where java - java -version - wmic computersystem get TotalPhysicalMemory - wmic cpu list - wmic logicaldisk get description,name - wmic VOLUME list - set - displayName: 'System info' - - - script: | - rd /Q /S $(WORK_DIR) & mkdir $(WORK_DIR) - rd /Q /S $(BUILD_DIR) & mkdir $(BUILD_DIR) - displayName: 'Make dir' - - - checkout: self - clean: true - lfs: false - submodules: recursive - path: openvino_contrib - - - checkout: openvino - clean: true - lfs: false - submodules: recursive - path: openvino - - - script: | - certutil -urlcache -split -f https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip ninja-win.zip - powershell -command "Expand-Archive -Force ninja-win.zip" - workingDirectory: $(WORK_DIR) - displayName: 'Install dependencies' - - - script: | - certutil -urlcache -split -f https://incredibuilddiag1wu2.blob.core.windows.net/incredibuild/IBSetupConsole_9_5_0.exe IBSetupConsole_9_5_0.exe - call IBSetupConsole_9_5_0.exe /Install /Components=Agent,oneuse /Coordinator=11.1.0.4 /AGENT:OPENFIREWALL=ON /AGENT:AUTOSELECTPORTS=ON /ADDTOPATH=ON /AGENT:INSTALLADDINS=OFF - workingDirectory: $(WORK_DIR) - displayName: 'Install IncrediBuild' - - - script: | - echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent - reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Xoreax\IncrediBuild\Builder /f /v LastEnabled /d 0 && echo Start IncrediBuild_Agent && net start IncrediBuild_Agent - displayName: 'Start IncrediBuild' - - - script: | - set PATH=$(WORK_DIR)\ninja-win;%PATH% - call "$(MSVS_VARS_PATH)" && cmake -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_JAVA=OFF -DIE_EXTRA_MODULES=$(REPO_DIR)/modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(OPENVINO_REPO_DIR) - workingDirectory: $(BUILD_DIR) - displayName: 'CMake' - - - script: | - set PATH=$(WORK_DIR)\ninja-win;%PATH% - call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="ninja" /MaxCPUS=40 - workingDirectory: $(BUILD_DIR) - displayName: 'Build Win' - - - script: echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent - displayName: Stop IncrediBuild - continueOnError: true - - - script: dir $(OPENVINO_REPO_DIR)\bin\ /s - displayName: 'List files' +resources: + repositories: + - repository: openvino + type: github + endpoint: openvinotoolkit + name: openvinotoolkit/openvino + + - repository: testdata + type: github + endpoint: openvinotoolkit + name: openvinotoolkit/testdata + +jobs: +- job: Win + # About 150% of total time + timeoutInMinutes: 120 + + pool: + name: WIN_VMSS_VENV_F8S_WU2 + + variables: + system.debug: true + VSTS_HTTP_RETRY: 5 + VSTS_HTTP_TIMEOUT: 200 + WORKERS_NUMBER: 8 + BUILD_TYPE: Release + REPO_DIR: $(Build.Repository.LocalPath) + OPENVINO_REPO_DIR: $(REPO_DIR)\..\openvino + MODELS_PATH: $(REPO_DIR)\..\testdata + WORK_DIR: $(Pipeline.Workspace)\_w + BUILD_DIR: D:\build + BIN_DIR: $(OPENVINO_REPO_DIR)\bin\intel64 + MSVS_VARS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat + MSVC_COMPILER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe + + steps: + - script: | + powershell -command "Invoke-RestMethod -Headers @{\"Metadata\"=\"true\"} -Method GET -Uri http://169.254.169.254/metadata/instance/compute?api-version=2019-06-01 | format-custom" + where python3 + where python + python --version + where java + java -version + wmic computersystem get TotalPhysicalMemory + wmic cpu list + wmic logicaldisk get description,name + wmic VOLUME list + set + displayName: 'System info' + + - script: | + rd /Q /S $(WORK_DIR) & mkdir $(WORK_DIR) + rd /Q /S $(BUILD_DIR) & mkdir $(BUILD_DIR) + displayName: 'Make dir' + + - checkout: self + clean: true + lfs: false + submodules: recursive + path: openvino_contrib + + - checkout: openvino + clean: true + lfs: false + submodules: recursive + path: openvino + + - checkout: testdata + clean: true + lfs: true + path: testdata + + - script: | + certutil -urlcache -split -f https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip ninja-win.zip + powershell -command "Expand-Archive -Force ninja-win.zip" + workingDirectory: $(WORK_DIR) + displayName: 'Install dependencies' + + - script: | + certutil -urlcache -split -f https://incredibuilddiag1wu2.blob.core.windows.net/incredibuild/IBSetupConsole_9_5_0.exe IBSetupConsole_9_5_0.exe + call IBSetupConsole_9_5_0.exe /Install /Components=Agent,oneuse /Coordinator=11.1.0.4 /AGENT:OPENFIREWALL=ON /AGENT:AUTOSELECTPORTS=ON /ADDTOPATH=ON /AGENT:INSTALLADDINS=OFF + workingDirectory: $(WORK_DIR) + displayName: 'Install IncrediBuild' + + - script: | + echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent + reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Xoreax\IncrediBuild\Builder /f /v LastEnabled /d 0 && echo Start IncrediBuild_Agent && net start IncrediBuild_Agent + displayName: 'Start IncrediBuild' + + - script: | + set PATH=$(WORK_DIR)\ninja-win;%PATH% + call "$(MSVS_VARS_PATH)" && cmake -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_JAVA=OFF -DENABLE_TESTS=ON -DIE_EXTRA_MODULES=$(REPO_DIR)/modules -DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" -DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" $(OPENVINO_REPO_DIR) + workingDirectory: $(BUILD_DIR) + displayName: 'CMake' + + - script: | + set PATH=$(WORK_DIR)\ninja-win;%PATH% + call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="ninja" /MaxCPUS=40 + workingDirectory: $(BUILD_DIR) + displayName: 'Build Win' + + - script: echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent + displayName: Stop IncrediBuild + continueOnError: true + + - script: dir $(OPENVINO_REPO_DIR)\bin\ /s + displayName: 'List files' diff --git a/modules/java_api/tests/CMakeLists.txt b/modules/java_api/tests/CMakeLists.txt index cfcd022f1f2909..dbc2859dbbe091 100644 --- a/modules/java_api/tests/CMakeLists.txt +++ b/modules/java_api/tests/CMakeLists.txt @@ -1,15 +1,15 @@ # Copyright (C) 2020 Intel Corporation file(DOWNLOAD https://search.maven.org/remotecontent?filepath=junit/junit/4.13/junit-4.13.jar - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/junit-4.13.jar) + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/junit.jar) file(DOWNLOAD https://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/hamcrest-core-1.3.jar) + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/hamcrest-core.jar) file(GLOB_RECURSE java_tests_src ${CMAKE_CURRENT_SOURCE_DIR}/*.java) add_jar(ie_java_api_tests_jar SOURCES ${java_tests_src} ${PROJECT_SOURCE_DIR}/samples/ArgumentParser.java OUTPUT_NAME ie_java_api_tests - OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - INCLUDE_JARS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/*) + OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + INCLUDE_JARS inference_engine_jar ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/junit.jar ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/hamcrest-core.jar) add_dependencies(ie_java_api_tests_jar inference_engine_jar) diff --git a/modules/java_api/tests/OpenVinoTestRunner.java b/modules/java_api/tests/OpenVinoTestRunner.java index f1ee90cda5b5c8..842ecf39031e33 100644 --- a/modules/java_api/tests/OpenVinoTestRunner.java +++ b/modules/java_api/tests/OpenVinoTestRunner.java @@ -16,5 +16,8 @@ public static void main(String[] args) { for (Failure failure : result.getFailures()) { System.out.println(failure.toString()); } + if (!result.wasSuccessful()) { + System.exit(1); + } } }