AIDEGen: fix aidegen_functional_test failed in 2nd run.
The tool aidegen_functional_test failed in 2nd run because we 'make
clean' to create a clean environment. Add a argument '-m' to users
if they want to 'make clean' before testing.
Bug: 171447339
Test: 1. m aidegen_functional_test
2. aidegen_functional_test-dev -b
3. aidegen_functional_test-dev -b
it works.
4. aidegen_functional_test-dev -b -m
aidegen_functional_test-dev -b
Change-Id: Icd4f4f8bc5191a302ea6c979a5cdfa8e16ac89d0
diff --git a/aidegen_functional_test/aidegen_functional_test_main.py b/aidegen_functional_test/aidegen_functional_test_main.py
index 6f10eba..62b2b0e 100644
--- a/aidegen_functional_test/aidegen_functional_test_main.py
+++ b/aidegen_functional_test/aidegen_functional_test_main.py
@@ -117,6 +117,12 @@
'--remove_bp_json',
action='store_true',
help='Remove module_bp_java_deps.json for each use case test.')
+ parser.add_argument(
+ '-m',
+ '--make_clean',
+ action='store_true',
+ help=('Make clean before testing to create a clean environment, the '
+ 'aidegen_functional_test can run only once if users command it.'))
group.add_argument(
'-u',
'--use_cases',
@@ -376,6 +382,7 @@
Args:
test_list: a list of module name and module path.
+
Returns:
data: a dictionary contains dependent files' data of project file's
contents.
@@ -394,7 +401,6 @@
]
}
"""
- _make_clean()
data = {}
spec_and_cur_commit_id_dict = _checkout_baseline_code_to_spec_commit_id()
for target in test_list:
@@ -609,7 +615,6 @@
'%s does not exist, error: %s.' % (verified_file_path, err))
if not is_presubmit:
- _make_clean()
_compare_sample_native_content()
os.chdir(common_util.get_android_root_dir())
@@ -753,6 +758,10 @@
args = _parse_args(argv)
common_util.configure_logging(args.verbose)
os.environ[constant.AIDEGEN_TEST_MODE] = 'true'
+
+ if args.make_clean:
+ _make_clean()
+
if args.create_sample:
_create_some_sample_json_file(args.targets)
elif args.use_cases_verified:
@@ -770,6 +779,7 @@
_test_some_sample_iml()
else:
_test_some_sample_iml(args.targets)
+
del os.environ[constant.AIDEGEN_TEST_MODE]