pytorch/test/cpp/jit
Michael Andreas Dagitses f96d96a7fc turn on -Werror=type-limits in our Bazel CPU build
Summary:
We also fix any existing issues.

Test Plan: Built locally, rely on CI to confirm.

Reviewers: malfet

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79139

Approved by: https://github.com/seemethere, https://github.com/osalpekar, https://github.com/albanD
2022-06-10 10:04:08 +00:00
..
upgrader_models Add upgrader related logic to flatbuffer (#71451) 2022-04-17 18:51:23 +00:00
__init__.py
CMakeLists.txt Link BLAS privately (#78883) 2022-06-09 17:02:06 +00:00
README.md
script_module_v4.ptl
script_module_v5.ptl
script_module_v6.ptl
source_range_test.cpp Reland "Make debug_pkl smaller by only emitting unique traces." (#73368) 2022-04-18 22:34:21 +00:00
test_add_if_then_else.cpp [JIT][SR] Introduce prim::IfThenElse (#72587) 2022-02-17 18:22:48 +00:00
test_alias_analysis.cpp Make string serialization of C++ FunctionSchema consistent with torchgen.model.FunctionSchema 2022-05-24 19:39:26 +00:00
test_argument_spec.cpp [jit] Remove graph() call from abstract Function interface. (#65967) 2021-10-27 11:54:26 -07:00
test_autodiff.cpp Clean up profiling mode and profiling executor strategy (#73875) 2022-03-29 18:38:51 +00:00
test_backend_compiler_lib.cpp [Pytorch Edge] Lean Runtime Test 2022-02-24 18:40:47 +00:00
test_backend_compiler_preprocess.cpp [jit] Remove graph() call from abstract Function interface. (#65967) 2021-10-27 11:54:26 -07:00
test_backend_lib.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_backend.cpp Reland "Make debug_pkl smaller by only emitting unique traces." (#73368) 2022-04-18 22:34:21 +00:00
test_class_import.cpp Add SourceView which doesn't own source text as base class of Source (#65309) 2021-10-18 23:17:22 -07:00
test_class_parser.cpp Add SourceView which doesn't own source text as base class of Source (#65309) 2021-10-18 23:17:22 -07:00
test_class_type.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_cleanup_passes.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_code_template.cpp [AutoAccept][Codemod][FBSourceClangFormatLinter] Daily arc lint --take CLANGFORMAT 2022-01-14 06:10:57 -08:00
test_concat_opt.cpp [JIT] Combine concat nodes where possible (#67000) 2021-11-15 12:02:45 -08:00
test_constant_pooling.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_create_autodiff_subgraphs.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_cs_debug_info_serialization.cpp
test_custom_class_registrations.cpp
test_custom_class_registrations.h
test_custom_class.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_custom_operators.cpp [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
test_dce.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_exception.cpp (2/2) Make TorchScript Preserve Fully Qualified Class Name for Python Exceptions: frontend change (#72899) 2022-02-16 03:45:15 +00:00
test_file_format.cpp [PyTorchEdge] Add getFileFormat() so we can differentiate Zip/Pickle from Flatbuffer (#73707) 2022-03-04 19:35:41 +00:00
test_flatbuffer.cpp Revert "Fix bug in flatbuffer deserialization" 2022-05-31 23:34:04 +00:00
test_fuser.cpp [NVFuser] prep for on-by-default 2022-05-06 18:18:53 +00:00
test_graph_executor.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_graph_iterator.cpp Fix sign-compare violations in cpp tests 2022-04-04 23:05:31 +00:00
test_inliner.cpp [jit] Remove graph() call from abstract Function interface. (#65967) 2021-10-27 11:54:26 -07:00
test_interface.cpp Add SourceView which doesn't own source text as base class of Source (#65309) 2021-10-18 23:17:22 -07:00
test_interpreter_async.pt
test_interpreter.cpp [PyTorch Edge] Backport function for defaults args with out args, flag on (#63651) 2021-09-20 22:50:30 -07:00
test_ir.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_irparser.cpp [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
test_jit_logging_levels.cpp Added jit log stream changing function and some refactor (#65768) 2021-09-30 23:25:11 -07:00
test_jit_type.cpp [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
test_lite_interpreter_direct.cpp [Pytorch Edge] Refactor Compatibility Stuff into own directory (#71432) 2022-01-20 19:38:41 +00:00
test_lite_interpreter.cpp turn on -Werror=type-limits in our Bazel CPU build 2022-06-10 10:04:08 +00:00
test_lite_trainer.cpp turn on -Werror=type-limits in our Bazel CPU build 2022-06-10 10:04:08 +00:00
test_load_upgraders.cpp Bump version number to 7 and compile old operators with old schema (#68358) 2022-01-05 23:57:22 -08:00
test_memory_dag.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_misc.cpp Make SymInt constructor explicit 2022-05-17 22:28:35 +00:00
test_mobile_type_parser.cpp [jit][edge] Migrate base types to DynamicType on mobile. (#70233) 2022-01-11 13:53:29 -08:00
test_module_api.cpp Fix bug where frozen mod not used for OFI #68903 (#71436) 2022-01-27 23:37:50 +00:00
test_op_replacement.cpp Add graph op replacement pass (#69915) 2021-12-25 13:03:19 -08:00
test_peephole_optimize.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_qualified_name.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_save_load.cpp Added directory check before saving in C++ API 2022-04-22 20:04:41 +00:00
test_schema_matching.cpp [jit] Make operation call accept Stack& instead Stack* (#63414) 2021-08-30 11:49:20 -07:00
test_script_profile.cpp
test_shape_analysis.cpp Adding support for upper and lower bound functions in SSA 2022-05-20 23:58:40 +00:00
test_stack_opt.cpp [JIT] Add variadic stack op (#63578) 2021-08-24 08:20:54 -07:00
test_subgraph_matcher.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_subgraph_rewriter.cpp keep output type after calling SubgraphRewriter (#65453) 2021-09-24 11:07:40 -07:00
test_subgraph_utils.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
test_union.cpp [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
test_upgrader_utils.cpp Add option to load historic operators in IR when the operator is deprecated (#71148) 2022-01-12 11:07:04 -08:00
test_utils.cpp [jit] Make operation call accept Stack& instead Stack* (#63414) 2021-08-30 11:49:20 -07:00
test_utils.h Reland "Make debug_pkl smaller by only emitting unique traces." (#73368) 2022-04-18 22:34:21 +00:00
tests_setup.py Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default 2021-08-12 11:45:01 -07:00
torch_python_test.cpp Remove WindowsTorchApiMacro.h in favor of Export.h (#69585) 2021-12-09 17:30:09 -08:00

JIT C++ Tests

Adding a new test

First, create a new test file. Test files should have be placed in this directory, with a name that starts with test_, like test_foo.cpp.

In general a single test suite

Add your test file to the JIT_TEST_SRCS list in test/cpp/jit/CMakeLists.txt.

A test file may look like:

#include <gtest/gtest.h>

using namespace ::torch::jit

TEST(FooTest, BarBaz) {
   // ...
}

// Append '_CUDA' to the test case name will automatically filter it out if CUDA
// is not compiled.
TEST(FooTest, NeedsAGpu_CUDA) {
   // ...
}

// Similarly, if only one GPU is detected, tests with `_MultiCUDA` at the end
// will not be run.
TEST(FooTest, NeedsMultipleGpus_MultiCUDA) {
   // ...
}

Building and running the tests

The following commands assume you are in PyTorch root.

# ... Build PyTorch from source, e.g.
python setup.py develop
# (re)build just the binary
ninja -C build bin/test_jit
# run tests
build/bin/test_jit --gtest_filter='glob_style_filter*'