Convert ctests into another test sources that can be compiled in Android test.

The existing ctests cannot be simply used in Android tests because
everything is compiled as standalone executable with `main()` function.
Since Android 11+ does not support standalone executables, those test
`main()` functions are converted as unique functions and then picked up
in this test's native-lib CMakeLists.txt.

Since those tests depend on libfluidsynth internals, we cannot simply
link with libfluidsynth.so. We instead compile the library with OBJ files.
This commit is contained in:
atsushieno 2021-06-11 02:15:12 +09:00
parent 962a544d15
commit 12cc9ed74b
4 changed files with 34 additions and 35 deletions

View file

@ -0,0 +1,4 @@
#!/bin/sh
for f in `grep -lR "int main(void)" ../test/` ; do export TESTMAINNAME=`echo $f | sed -e "s/\.\.\/test\/test_\(.*\).c$/\1/"` && sed -e "s/int main(void)/int "$TESTMAINNAME"_main(void)/" $f > app/src/main/cpp/tests/test_$TESTMAINNAME.c ; done