Add tests for converting license in androidmk

1. Added unit tests for license conversions in the androidmk tool, by
using a mocked filesystem;
2. Added integration tests in a shell script with a mocked filesystem.

Bug: 205615944
Test: m androidmk
Test: bash androidmk_test.sh
Test: TreeHugger
Change-Id: Id3d1f914190b52b82aadda7ea019192787b839d6
This commit is contained in:
Yuntao Xu
2021-11-22 09:30:08 -08:00
parent 23d5d986fe
commit 21be0e26b9
6 changed files with 402 additions and 34 deletions

View File

@@ -1537,9 +1537,11 @@ android_app {
},
{
desc: "LOCAL_LICENSE_KINDS, LOCAL_LICENSE_CONDITIONS, LOCAL_NOTICE_FILE",
// TODO(b/205615944): When valid "android_license_files" exists, the test requires an Android.mk
// file (and an Android.bp file is required as well if the license files locates outside the current
// directory). So plan to use a mock file system to mock the Android.mk and Android.bp files.
// When "android_license_files" is valid, the test requires an Android.mk file
// outside the current (and an Android.bp file is required as well if the license
// files locates directory), thus a mock file system is needed. The integration
// test cases for these scenarios have been added in
// $(ANDROID_BUILD_TOP)/build/soong/tests/androidmk_test.sh.
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo