| 1 |
# This file does a regex file compare on the generated |
| 2 |
# Android.mk files from the AndroidMK test |
| 3 |
|
| 4 |
macro(compare_file_to_expected file expected_file) |
| 5 |
file(READ "${file}" ANDROID_MK) |
| 6 |
# clean up new lines |
| 7 |
string(REGEX REPLACE "\r\n" "\n" ANDROID_MK "${ANDROID_MK}") |
| 8 |
string(REGEX REPLACE "\n+$" "" ANDROID_MK "${ANDROID_MK}") |
| 9 |
# read in the expected regex file |
| 10 |
file(READ "${expected_file}" expected) |
| 11 |
# clean up new lines |
| 12 |
string(REGEX REPLACE "\r\n" "\n" expected "${expected}") |
| 13 |
string(REGEX REPLACE "\n+$" "" expected "${expected}") |
| 14 |
# compare the file to the expected regex and if there is not a match |
| 15 |
# put an error message in RunCMake_TEST_FAILED |
| 16 |
if(NOT "${ANDROID_MK}" MATCHES "${expected}") |
| 17 |
set(RunCMake_TEST_FAILED |
| 18 |
"${file} does not match ${expected_file}: |
| 19 |
|
| 20 |
Android.mk contents = [\n${ANDROID_MK}\n] |
| 21 |
Expected = [\n${expected}\n]") |
| 22 |
endif() |
| 23 |
endmacro() |
| 24 |
|
| 25 |
compare_file_to_expected( |
| 26 |
"${RunCMake_BINARY_DIR}/AndroidMK-build/Android.mk" |
| 27 |
"${RunCMake_TEST_SOURCE_DIR}/expectedBuildAndroidMK.txt") |
| 28 |
compare_file_to_expected( |
| 29 |
"${RunCMake_BINARY_DIR}/AndroidMK-build/CMakeFiles/Export/c8a72b7cccded047a31c221a6b84dd48/Android.mk" |
| 30 |
"${RunCMake_TEST_SOURCE_DIR}/expectedInstallAndroidMK.txt") |