Rename libtestercore.so to libdeqp.so

Since dEQP is now being built as part of the Android CTS as well,
the name libtestercore.so isn't very descriptive any more. This change
renames the library to libdeqp.so.

This change also drops some dead code related to API level < 9 support.

Change-Id: I03b60fd6d9cc6252651f25610e7c72bbc450670c
diff --git a/Android.mk b/Android.mk
index 28a33c2..6e9028e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -5,7 +5,7 @@
 deqp_dir := $(LOCAL_PATH)/
 
 LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE := libtestercore
+LOCAL_MODULE := libdeqp
 LOCAL_SRC_FILES := \
 	execserver/xsDefs.cpp \
 	execserver/xsExecutionServer.cpp \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f04916c..02cb573 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -320,8 +320,8 @@
 	include_directories(framework/platform/android)
 	include_directories(executor)
 
-	add_library(testercore SHARED framework/platform/android/tcuAndroidMain.cpp framework/platform/android/tcuAndroidJNI.cpp framework/platform/android/tcuTestLogParserJNI.cpp ${DEQP_MODULE_ENTRY_POINTS})
-	target_link_libraries(testercore tcutil-platform xecore ${DEQP_MODULE_LIBRARIES})
+	add_library(deqp SHARED framework/platform/android/tcuAndroidMain.cpp framework/platform/android/tcuAndroidJNI.cpp framework/platform/android/tcuTestLogParserJNI.cpp ${DEQP_MODULE_ENTRY_POINTS})
+	target_link_libraries(deqp tcutil-platform xecore ${DEQP_MODULE_LIBRARIES})
 
 elseif (DE_OS_IS_IOS)
 	# Code sign identity
diff --git a/android/package/Android.mk b/android/package/Android.mk
index 54264c1..d4015a3 100644
--- a/android/package/Android.mk
+++ b/android/package/Android.mk
@@ -4,7 +4,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_JNI_SHARED_LIBRARIES := libtestercore
+LOCAL_JNI_SHARED_LIBRARIES := libdeqp
 
 LOCAL_ASSET_DIR := $(LOCAL_PATH)/../../data
 LOCAL_PACKAGE_NAME := com.drawelements.deqp
diff --git a/android/package/AndroidManifest.xml b/android/package/AndroidManifest.xml
index 33380c2..4da88a1 100644
--- a/android/package/AndroidManifest.xml
+++ b/android/package/AndroidManifest.xml
@@ -33,7 +33,7 @@
 				  android:exported="true"
 				  android:process=":testercore">
 			<meta-data android:name="android.app.lib_name"
-					   android:value="testercore" />
+					   android:value="deqp" />
 			<meta-data android:name="android.app.func_name"
 					   android:value="createTestActivity" />
 		</activity>
diff --git a/android/package/src/com/drawelements/deqp/execserver/ExecService.java b/android/package/src/com/drawelements/deqp/execserver/ExecService.java
index 140339b..84d0909 100644
--- a/android/package/src/com/drawelements/deqp/execserver/ExecService.java
+++ b/android/package/src/com/drawelements/deqp/execserver/ExecService.java
@@ -38,12 +38,7 @@
 
 public class ExecService extends Service {
 	static {
-		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
-			System.loadLibrary("testercore");
-		} else {
-			// Pre-gingerbread version without EGL tests.
-			System.loadLibrary("testercore_legacy");
-		}
+		System.loadLibrary("deqp");
 	}
 
 	long m_server = 0; //!< Server pointer.
diff --git a/android/package/src/com/drawelements/deqp/testercore/TestLogParser.java b/android/package/src/com/drawelements/deqp/testercore/TestLogParser.java
index f5befc8..05ee665 100644
--- a/android/package/src/com/drawelements/deqp/testercore/TestLogParser.java
+++ b/android/package/src/com/drawelements/deqp/testercore/TestLogParser.java
@@ -32,7 +32,7 @@
 public class TestLogParser
 {
 	static {
-		System.loadLibrary("testercore");
+		System.loadLibrary("deqp");
 	}
 
 	private long				m_nativePointer;
diff --git a/android/scripts/build.py b/android/scripts/build.py
index 37a3f52..2f3d7b2 100644
--- a/android/scripts/build.py
+++ b/android/scripts/build.py
@@ -33,12 +33,24 @@
 def getAssetsDir (nativeLib, buildType):
 	return os.path.join(getNativeBuildDir(nativeLib, buildType), "assets")
 
+def getPrebuiltsDirName (abiName):
+	PREBUILT_DIRS = {
+			'x86':			'android-x86',
+			'armeabi-v7a':	'android-arm',
+			'arm64-v8a':	'android-arm64'
+		}
+
+	if not abiName in PREBUILT_DIRS:
+		raise Exception("Unknown ABI %s, don't know where prebuilts are" % abiName)
+
+	return PREBUILT_DIRS[abiName]
+
 def buildNative (nativeLib, buildType):
 	deqpDir		= os.path.normpath(os.path.join(common.ANDROID_DIR, ".."))
 	buildDir	= getNativeBuildDir(nativeLib, buildType)
 	libsDir		= os.path.join(BASE_LIBS_DIR, nativeLib.abiVersion)
-	srcLibFile	= os.path.join(buildDir, "libtestercore.so")
-	dstLibFile	= os.path.join(libsDir, "lib%s.so" % nativeLib.libName)
+	srcLibFile	= os.path.join(buildDir, common.NATIVE_LIB_NAME)
+	dstLibFile	= os.path.join(libsDir, common.NATIVE_LIB_NAME)
 
 	# Make build directory if necessary
 	if not os.path.exists(buildDir):
@@ -63,20 +75,15 @@
 	if not os.path.exists(libsDir):
 		os.makedirs(libsDir)
 
-	# Copy libtestercore.so
 	shutil.copyfile(srcLibFile, dstLibFile)
 
 	# Copy gdbserver for debugging
 	if buildType.lower() == "debug":
-		if nativeLib.abiVersion == "x86":
-			shutil.copyfile(os.path.join(common.ANDROID_NDK_PATH, "prebuilt/android-x86/gdbserver/gdbserver"), os.path.join(libsDir, "gdbserver"))
-		elif nativeLib.abiVersion == "armeabi-v7a":
-			shutil.copyfile(os.path.join(common.ANDROID_NDK_PATH, "prebuilt/android-arm/gdbserver/gdbserver"), os.path.join(libsDir, "gdbserver"))
-		else:
-			print("Unknown ABI. Won't copy gdbserver to package")
-	elif os.path.exists(os.path.join(libsDir, "gdbserver")):
-		# Make sure there is no gdbserver if build is not debug build
-		os.unlink(os.path.join(libsDir, "gdbserver"))
+		srcGdbserverPath	= os.path.join(common.ANDROID_NDK_PATH, 'prebuilt', getPrebuiltsDirName(nativeLib.abiVersion), 'gdbserver', 'gdbserver')
+		dstGdbserverPath	= os.path.join(libsDir, 'gdbserver')
+		shutil.copyfile(srcGdbserverPath, dstGdbserverPath)
+	else:
+		assert not os.path.exists(os.path.join(libsDir, "gdbserver"))
 
 def buildApp (isRelease):
 	appDir	= os.path.join(common.ANDROID_DIR, "package")
diff --git a/android/scripts/common.py b/android/scripts/common.py
index 3d44c39..3b56e58 100644
--- a/android/scripts/common.py
+++ b/android/scripts/common.py
@@ -8,10 +8,9 @@
 import multiprocessing
 
 class NativeLib:
-	def __init__ (self, libName, apiVersion, abiVersion):
-		self.libName		= libName
-		self.apiVersion		= apiVersion
-		self.abiVersion		= abiVersion
+	def __init__ (self, apiVersion, abiVersion):
+		self.apiVersion	= apiVersion
+		self.abiVersion	= abiVersion
 
 def getPlatform ():
 	if sys.platform.startswith('linux'):
@@ -148,12 +147,13 @@
 
 # Build configuration
 NATIVE_LIBS				= [
-		#		  library name		API		ABI
-		NativeLib("testercore",		13,		"armeabi-v7a"),		# ARM v7a ABI
-		NativeLib("testercore",		13,		"x86"),				# x86
-		NativeLib("testercore",		21,		"arm64-v8a"),		# ARM64 v8a ABI
+		#		  API		ABI
+		NativeLib(13,		"armeabi-v7a"),		# ARM v7a ABI
+		NativeLib(13,		"x86"),				# x86
+		NativeLib(21,		"arm64-v8a"),		# ARM64 v8a ABI
 	]
 ANDROID_JAVA_API		= "android-13"
+NATIVE_LIB_NAME			= "libdeqp.so"
 
 # NDK paths
 ANDROID_NDK_PATH		= selectFirstExistingDir([
diff --git a/android/scripts/debug.py b/android/scripts/debug.py
index 17d8017..7989e56 100644
--- a/android/scripts/debug.py
+++ b/android/scripts/debug.py
@@ -117,8 +117,8 @@
 			print("Pull library %s from device" % lib)
 			common.execute("%s pull %s" % (adbCmd, lib))
 
-		print("Copy libtestercore.so from build dir")
-		shutil.copyfile(os.path.join(buildDir, "libtestercore.so"), "libtestercore.so")
+		print("Copy %s from build dir" % common.NATIVE_LIB_NAME)
+		shutil.copyfile(os.path.join(buildDir, common.NATIVE_LIB_NAME), common.NATIVE_LIB_NAME)
 
 		# Forward local port for jdb
 		print("Forward local port to jdb port")