Closed hanhanW closed 17 hours ago
In this PR, we have two unit test files locating at different directories:
I think we could put them under the same "unittests" directory, so it could be:
What do you think?
Okay, I'm going to land the change and unblock my work, because it looks like an improvement to me. I'm happy to address any post-commits.
Note: it is not shared with the runtime one because the runtime/compiler tests should not depend on each other. A potential refactoring is moving them to
iree/testing/*
and all the unit tests can depend on it.
We can keep them separate. It isn't much code to duplicate.
According to googletest primer, most users should not need to write their own main function and instead link with gtest_main (as opposed to with gtest), which defines a suitable entry point. The revision implements a main testing function for all the unittests under iree/compiler/. See https://google.github.io/googletest/primer.html#writing-the-main-function for more details.
IREE has few unit tests in comiler/. Similar to runtime/, the revision creates a gtest_main.cc which defines the main function. Thus, all the unit tests no longer need to define their own main function.
Inlining LLVM unit test guide to distinguish what is expected to test with unit tests:
In general unit tests are reserved for targeting the support library and other generic data structure, we prefer relying on regression tests for testing transformations and analysis on the IR.
Note: it is not shared with the runtime one because the runtime/compiler tests should not depend on each other. A potential refactoring is moving them to
iree/testing/*
and all the unit tests can depend on it.