build/core: introduce internal ndk-build unit tests.

This patch introduces many unit test related definitions
under build/core/definitions-tests.mk, and also implement
a few unit tests for the functions in build/core/definitions.mk

Note that there are still functions acting on global variables,
that are harder to test this way. A future patch might make
these more testable in the future.

The test functions are not run during a ndk-build pass, unless
NDK_UNIT_TESTS is defined, so this won't slow down regular
builds.

There is a new build test to run all the unit tests and easily
detect regressions when invoking tests/run-tests.sh

Finally, the last2 and last3 functions were removed, they were
not used, and testing showed they didn't work correctly (ah ah).

Change-Id: I72a31bdc0126528c260f1c7565f88f100203a353
4 files changed