This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathtest_ovtf.py
executable file
·57 lines (42 loc) · 1.59 KB
/
test_ovtf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
# ==============================================================================
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# ==============================================================================
import argparse
import errno
import os
import sys
import shutil
import glob
import platform
from distutils.sysconfig import get_python_lib
from tools.test_utils import *
def main():
'''
Tests openvino tensorflow Python 3. This script needs to be run after
running build_ovtf.py which builds the openvino_tensorflow
and installs it to a virtual environment that would be used by this script.
'''
root_pwd = os.getcwd()
build_dir = 'build_cmake'
venv_dir = 'build_cmake/venv-tf-py3'
artifacts_dir = os.path.join(build_dir, 'artifacts')
load_venv(venv_dir)
# disable dynamic fallback for OVTF and TF tests at once
openvino_tf_dynamic_fallback = os.environ.pop(
'OPENVINO_TF_DYNAMIC_FALLBACK', None)
os.environ['OPENVINO_TF_DYNAMIC_FALLBACK'] = '0'
# First run the C++ gtests
run_ovtf_cpp_gtests(artifacts_dir, './', None)
# Next run Python unit tests
run_ovtf_pytests_from_artifacts(artifacts_dir)
# Run Python tests borrowed from TF
run_tensorflow_pytests_from_artifacts(
'./', artifacts_dir + '/tensorflow/python', False)
os.environ.pop('OPENVINO_TF_DYNAMIC_FALLBACK', None)
if openvino_tf_dynamic_fallback is not None:
os.environ[
'OPENVINO_TF_DYNAMIC_FALLBACK'] = openvino_tf_dynamic_fallback
if __name__ == '__main__':
main()