microsoft/onnxruntime-extensions

Public

mirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
bfbfa5a3044ec8d1312f3782c78ea3b9246bf667

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

test/test_cmake_helper.py

29lines · modecode

1import os
2import unittest
3from pathlib import Path
4from onnxruntime_extensions import cmake_helper
5
6
7def _get_test_data_file(*sub_dirs):
8 test_dir = Path(__file__).parent
9 return str(test_dir.joinpath(*sub_dirs))
10
11
12class TestCMakeHelper(unittest.TestCase):
13 def test_cmake_file_gen(self):
14 cfgfile = _get_test_data_file('data', 'test.op.config')
15 cfile = '_selectedoplist.cmake'
16 cmake_helper.gen_cmake_oplist(cfgfile, cfile)
17 found = False
18 with open(cfile, 'r') as f:
19 for _ln in f:
20 if _ln.strip() == "set(OCOS_ENABLE_GPT2_TOKENIZER ON CACHE INTERNAL \"\")":
21 found = True
22 break
23
24 os.remove(cfile)
25 self.assertTrue(found)
26
27
28if __name__ == "__main__":
29 unittest.main()
30