2020-06-26 14:10:58 +08:00
|
|
|
# RUN: %PYTHON %s
|
|
|
|
|
2020-06-30 07:19:03 +08:00
|
|
|
import os
|
|
|
|
os.environ["NUMPY_EXPERIMENTAL_ARRAY_FUNCTION"] = "1"
|
|
|
|
|
|
|
|
import traceback
|
|
|
|
|
2020-06-26 14:10:58 +08:00
|
|
|
|
|
|
|
def run_doctest(mod):
|
2020-06-30 07:19:03 +08:00
|
|
|
print("\n\nTESTING:", mod)
|
|
|
|
print("--------")
|
2020-06-26 14:10:58 +08:00
|
|
|
import doctest
|
|
|
|
import sys
|
|
|
|
import importlib
|
2020-06-30 07:19:03 +08:00
|
|
|
try:
|
|
|
|
m = importlib.import_module(mod)
|
|
|
|
except:
|
|
|
|
print("ERROR IMPORTING MODULE:", mod)
|
|
|
|
sys.exit(1)
|
2020-06-26 14:10:58 +08:00
|
|
|
fc, _ = doctest.testmod(m)
|
|
|
|
if fc:
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
2020-06-30 07:19:03 +08:00
|
|
|
TEST_MODULES = (
|
|
|
|
"npcomp.compiler.py_value_utils",
|
|
|
|
"npcomp.dialect.Basicpy",
|
|
|
|
"npcomp.dialect.Numpy",
|
|
|
|
"npcomp.tracing.context",
|
|
|
|
"npcomp.tracing.emitters",
|
|
|
|
"npcomp.tracing.mlir_trace",
|
|
|
|
"npcomp.types",
|
|
|
|
"npcomp.exporter",
|
|
|
|
)
|
|
|
|
|
|
|
|
for mname in TEST_MODULES:
|
|
|
|
run_doctest(mname)
|