-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This diff is to set up test cases that can be used to determine if classes are being kept as entry points when they have class names appearing in a file under META-INF/services directory in the input application. Reviewed By: NTillmann Differential Revision: D57521904 fbshipit-source-id: 943bf232d381196f00e220c1699f2bd3151d1f3d
- Loading branch information
1 parent
47095b9
commit 58721c6
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "ReachableServiceLoaderVerifyImpl.h" | ||
|
||
TEST_F(PreVerify, ApkReachableServiceLoaderTest) { | ||
verify_exception_handlers_kept(classes); | ||
} | ||
|
||
TEST_F(PostVerify, ApkReachableServiceLoaderTest) { | ||
// TODO: should have same classes as in pre-verify. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "ReachableServiceLoaderVerifyImpl.h" | ||
|
||
TEST_F(PreVerify, BundleReachableServiceLoaderTest) { | ||
verify_exception_handlers_kept(classes); | ||
} | ||
|
||
TEST_F(PostVerify, BundleReachableServiceLoaderTest) { | ||
// TODO: should have same classes as in pre-verify. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"redex" : { | ||
"passes" : [ | ||
"RemoveUnreachablePass" | ||
"RemoveUnreachablePass", | ||
"RegAllocPass" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "verify/VerifyUtil.h" | ||
|
||
inline void verify_exception_handlers_kept(const DexClasses& classes) { | ||
const char* const INTERFACE_NAME = | ||
"Lkotlinx/coroutines/CoroutineExceptionHandler;"; | ||
const char* const IMPLEMENTATION_NAME = | ||
"Lkotlinx/coroutines/android/AndroidExceptionPreHandler;"; | ||
|
||
auto iface = find_class_named(classes, INTERFACE_NAME); | ||
EXPECT_NE(iface, nullptr) << "Did not find class " << INTERFACE_NAME; | ||
auto cls = find_class_named(classes, IMPLEMENTATION_NAME); | ||
EXPECT_NE(cls, nullptr) << "Did not find class " << IMPLEMENTATION_NAME; | ||
} |