Enable whole-archive flag in cc_test and use cc_test to rewrite the CMakeLists.txt of inference unittest.