Browse Source

* Support for running tests on a remote Android device using ADB.

git-svn-id: branches/targetandroid@23226 -
yury 12 years ago
parent
commit
663f354471
5 changed files with 280 additions and 50 deletions
  1. 119 17
      tests/Makefile
  2. 3 0
      tests/Makefile.fpc
  3. 3 0
      tests/readme.txt
  4. 116 17
      tests/tstunits/Makefile
  5. 39 16
      tests/utils/dotest.pp

+ 119 - 17
tests/Makefile

@@ -1,10 +1,10 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/05/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/12/26]
 #
 #
 default: allexectests
 default: allexectests
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) solaris qnx haiku aix
+UNIXs = linux $(BSDs) solaris qnx haiku aix android
 LIMIT83fs = go32v2 os2 emx watcom
 LIMIT83fs = go32v2 os2 emx watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 FORCE:
 FORCE:
@@ -258,13 +258,11 @@ ifndef BINUTILSPREFIX
 ifndef CROSSBINDIR
 ifndef CROSSBINDIR
 ifdef CROSSCOMPILE
 ifdef CROSSCOMPILE
 ifndef DARWIN2DARWIN
 ifndef DARWIN2DARWIN
-ifneq ($(CPU_TARGET),jvm)
 BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
 BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
 endif
 endif
 endif
 endif
 endif
 endif
 endif
 endif
-endif
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
 ifeq ($(UNITSDIR),)
 ifeq ($(UNITSDIR),)
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
@@ -360,6 +358,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override TARGET_PROGRAMS+=gparmake
 override TARGET_PROGRAMS+=gparmake
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_PROGRAMS+=gparmake
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_PROGRAMS+=gparmake
 override TARGET_PROGRAMS+=gparmake
 endif
 endif
@@ -471,6 +472,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override TARGET_PROGRAMS+=gparmake
 override TARGET_PROGRAMS+=gparmake
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_PROGRAMS+=gparmake
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_PROGRAMS+=gparmake
 override TARGET_PROGRAMS+=gparmake
 endif
 endif
@@ -733,6 +737,12 @@ SHAREDLIBEXT=.dll
 SHORTSUFFIX=wat
 SHORTSUFFIX=wat
 IMPORTLIBPREFIX=
 IMPORTLIBPREFIX=
 endif
 endif
+ifeq ($(OS_TARGET),android)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 BATCHEXT=.sh
 BATCHEXT=.sh
 EXEEXT=
 EXEEXT=
@@ -862,18 +872,6 @@ BATCHEXT=.sh
 EXEEXT=
 EXEEXT=
 SHORTSUFFIX=aix
 SHORTSUFFIX=aix
 endif
 endif
-ifeq ($(OS_TARGET),java)
-OEXT=.class
-ASMEXT=.j
-SHAREDLIBEXT=.jar
-SHORTSUFFIX=java
-endif
-ifeq ($(OS_TARGET),android)
-OEXT=.class
-ASMEXT=.j
-SHAREDLIBEXT=.jar
-SHORTSUFFIX=android
-endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
@@ -1182,6 +1180,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
@@ -1293,6 +1294,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
@@ -1476,12 +1480,17 @@ endif
 endif
 endif
 ifdef CREATESHARED
 ifdef CREATESHARED
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
 endif
 endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
 ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifeq ($(CPU_TARGET),x86_64)
 ifeq ($(CPU_TARGET),x86_64)
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
 endif
 endif
 endif
 endif
+endif
 ifdef LINKSHARED
 ifdef LINKSHARED
 endif
 endif
 ifdef OPT
 ifdef OPT
@@ -1866,6 +1875,96 @@ endif
 fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
 fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifdef TARGET_DIRS_TARGET_DIRS
+TARGET_DIRS_all:
+	$(MAKE) -C TARGET_DIRS all
+TARGET_DIRS_debug:
+	$(MAKE) -C TARGET_DIRS debug
+TARGET_DIRS_smart:
+	$(MAKE) -C TARGET_DIRS smart
+TARGET_DIRS_release:
+	$(MAKE) -C TARGET_DIRS release
+TARGET_DIRS_units:
+	$(MAKE) -C TARGET_DIRS units
+TARGET_DIRS_examples:
+	$(MAKE) -C TARGET_DIRS examples
+TARGET_DIRS_shared:
+	$(MAKE) -C TARGET_DIRS shared
+TARGET_DIRS_install:
+	$(MAKE) -C TARGET_DIRS install
+TARGET_DIRS_sourceinstall:
+	$(MAKE) -C TARGET_DIRS sourceinstall
+TARGET_DIRS_exampleinstall:
+	$(MAKE) -C TARGET_DIRS exampleinstall
+TARGET_DIRS_distinstall:
+	$(MAKE) -C TARGET_DIRS distinstall
+TARGET_DIRS_zipinstall:
+	$(MAKE) -C TARGET_DIRS zipinstall
+TARGET_DIRS_zipsourceinstall:
+	$(MAKE) -C TARGET_DIRS zipsourceinstall
+TARGET_DIRS_zipexampleinstall:
+	$(MAKE) -C TARGET_DIRS zipexampleinstall
+TARGET_DIRS_zipdistinstall:
+	$(MAKE) -C TARGET_DIRS zipdistinstall
+TARGET_DIRS_clean:
+	$(MAKE) -C TARGET_DIRS clean
+TARGET_DIRS_distclean:
+	$(MAKE) -C TARGET_DIRS distclean
+TARGET_DIRS_cleanall:
+	$(MAKE) -C TARGET_DIRS cleanall
+TARGET_DIRS_info:
+	$(MAKE) -C TARGET_DIRS info
+TARGET_DIRS_makefiles:
+	$(MAKE) -C TARGET_DIRS makefiles
+TARGET_DIRS:
+	$(MAKE) -C TARGET_DIRS all
+.PHONY: TARGET_DIRS_all TARGET_DIRS_debug TARGET_DIRS_smart TARGET_DIRS_release TARGET_DIRS_units TARGET_DIRS_examples TARGET_DIRS_shared TARGET_DIRS_install TARGET_DIRS_sourceinstall TARGET_DIRS_exampleinstall TARGET_DIRS_distinstall TARGET_DIRS_zipinstall TARGET_DIRS_zipsourceinstall TARGET_DIRS_zipexampleinstall TARGET_DIRS_zipdistinstall TARGET_DIRS_clean TARGET_DIRS_distclean TARGET_DIRS_cleanall TARGET_DIRS_info TARGET_DIRS_makefiles TARGET_DIRS
+endif
+ifdef TARGET_EXAMPLEDIRS_TARGET_EXAMPLEDIRS
+TARGET_EXAMPLEDIRS_all:
+	$(MAKE) -C TARGET_EXAMPLEDIRS all
+TARGET_EXAMPLEDIRS_debug:
+	$(MAKE) -C TARGET_EXAMPLEDIRS debug
+TARGET_EXAMPLEDIRS_smart:
+	$(MAKE) -C TARGET_EXAMPLEDIRS smart
+TARGET_EXAMPLEDIRS_release:
+	$(MAKE) -C TARGET_EXAMPLEDIRS release
+TARGET_EXAMPLEDIRS_units:
+	$(MAKE) -C TARGET_EXAMPLEDIRS units
+TARGET_EXAMPLEDIRS_examples:
+	$(MAKE) -C TARGET_EXAMPLEDIRS examples
+TARGET_EXAMPLEDIRS_shared:
+	$(MAKE) -C TARGET_EXAMPLEDIRS shared
+TARGET_EXAMPLEDIRS_install:
+	$(MAKE) -C TARGET_EXAMPLEDIRS install
+TARGET_EXAMPLEDIRS_sourceinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS sourceinstall
+TARGET_EXAMPLEDIRS_exampleinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS exampleinstall
+TARGET_EXAMPLEDIRS_distinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS distinstall
+TARGET_EXAMPLEDIRS_zipinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipinstall
+TARGET_EXAMPLEDIRS_zipsourceinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipsourceinstall
+TARGET_EXAMPLEDIRS_zipexampleinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipexampleinstall
+TARGET_EXAMPLEDIRS_zipdistinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipdistinstall
+TARGET_EXAMPLEDIRS_clean:
+	$(MAKE) -C TARGET_EXAMPLEDIRS clean
+TARGET_EXAMPLEDIRS_distclean:
+	$(MAKE) -C TARGET_EXAMPLEDIRS distclean
+TARGET_EXAMPLEDIRS_cleanall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS cleanall
+TARGET_EXAMPLEDIRS_info:
+	$(MAKE) -C TARGET_EXAMPLEDIRS info
+TARGET_EXAMPLEDIRS_makefiles:
+	$(MAKE) -C TARGET_EXAMPLEDIRS makefiles
+TARGET_EXAMPLEDIRS:
+	$(MAKE) -C TARGET_EXAMPLEDIRS all
+.PHONY: TARGET_EXAMPLEDIRS_all TARGET_EXAMPLEDIRS_debug TARGET_EXAMPLEDIRS_smart TARGET_EXAMPLEDIRS_release TARGET_EXAMPLEDIRS_units TARGET_EXAMPLEDIRS_examples TARGET_EXAMPLEDIRS_shared TARGET_EXAMPLEDIRS_install TARGET_EXAMPLEDIRS_sourceinstall TARGET_EXAMPLEDIRS_exampleinstall TARGET_EXAMPLEDIRS_distinstall TARGET_EXAMPLEDIRS_zipinstall TARGET_EXAMPLEDIRS_zipsourceinstall TARGET_EXAMPLEDIRS_zipexampleinstall TARGET_EXAMPLEDIRS_zipdistinstall TARGET_EXAMPLEDIRS_clean TARGET_EXAMPLEDIRS_distclean TARGET_EXAMPLEDIRS_cleanall TARGET_EXAMPLEDIRS_info TARGET_EXAMPLEDIRS_makefiles TARGET_EXAMPLEDIRS
+endif
 debug: fpc_debug
 debug: fpc_debug
 smart: fpc_smart
 smart: fpc_smart
 release: fpc_release
 release: fpc_release
@@ -2110,6 +2209,9 @@ endif
 ifdef TEST_PUTTY
 ifdef TEST_PUTTY
 override DOTESTOPT+=-R$(TEST_PUTTY) -W
 override DOTESTOPT+=-R$(TEST_PUTTY) -W
 endif
 endif
+ifdef TEST_ADB
+override DOTESTOPT+=-ADB -R$(TEST_ADB)
+endif
 ifdef TEST_OPT
 ifdef TEST_OPT
 override DOTESTOPT+=$(addprefix -Y, $(TEST_OPT))
 override DOTESTOPT+=$(addprefix -Y, $(TEST_OPT))
 endif
 endif

+ 3 - 0
tests/Makefile.fpc

@@ -324,6 +324,9 @@ endif
 ifdef TEST_PUTTY
 ifdef TEST_PUTTY
 override DOTESTOPT+=-R$(TEST_PUTTY) -W
 override DOTESTOPT+=-R$(TEST_PUTTY) -W
 endif
 endif
+ifdef TEST_ADB
+override DOTESTOPT+=-ADB -R$(TEST_ADB)
+endif
 
 
 ifdef TEST_OPT
 ifdef TEST_OPT
 #  handles several options as well
 #  handles several options as well

+ 3 - 0
tests/readme.txt

@@ -172,6 +172,9 @@ TEST_RSH             set this to the hostname when you want to use rsh/rcp
                      to execute/copy the test
                      to execute/copy the test
 TEST_SSH             set this to use ssh/scp to execute the test
 TEST_SSH             set this to use ssh/scp to execute the test
 TEST_PUTTY           test using putty when remote testing (pscp and plink)
 TEST_PUTTY           test using putty when remote testing (pscp and plink)
+TEST_ADB             run tests om remote Android device using ADB. Specify
+                     TEST_ADB=1 to run on default connected device. Specify  
+                     TEST_ADB=<serial> to run on specific connected device.
 TEST_REMOTEOPT       extra options to remote program
 TEST_REMOTEOPT       extra options to remote program
 TEST_REMOTEPATH      set remote path to use, default is /tmp
 TEST_REMOTEPATH      set remote path to use, default is /tmp
 TEST_DELBEFORE       delete remote executable before uploading
 TEST_DELBEFORE       delete remote executable before uploading

+ 116 - 17
tests/tstunits/Makefile

@@ -1,10 +1,10 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/05/27]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/12/26]
 #
 #
 default: all
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) solaris qnx haiku aix
+UNIXs = linux $(BSDs) solaris qnx haiku aix android
 LIMIT83fs = go32v2 os2 emx watcom
 LIMIT83fs = go32v2 os2 emx watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 FORCE:
 FORCE:
@@ -258,13 +258,11 @@ ifndef BINUTILSPREFIX
 ifndef CROSSBINDIR
 ifndef CROSSBINDIR
 ifdef CROSSCOMPILE
 ifdef CROSSCOMPILE
 ifndef DARWIN2DARWIN
 ifndef DARWIN2DARWIN
-ifneq ($(CPU_TARGET),jvm)
 BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
 BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
 endif
 endif
 endif
 endif
 endif
 endif
 endif
 endif
-endif
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
 ifeq ($(UNITSDIR),)
 ifeq ($(UNITSDIR),)
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
@@ -360,6 +358,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override CLEAN_UNITS+=erroru popuperr ptest
 override CLEAN_UNITS+=erroru popuperr ptest
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override CLEAN_UNITS+=erroru popuperr ptest
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override CLEAN_UNITS+=erroru popuperr ptest
 override CLEAN_UNITS+=erroru popuperr ptest
 endif
 endif
@@ -471,6 +472,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override CLEAN_UNITS+=erroru popuperr ptest
 override CLEAN_UNITS+=erroru popuperr ptest
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override CLEAN_UNITS+=erroru popuperr ptest
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override CLEAN_UNITS+=erroru popuperr ptest
 override CLEAN_UNITS+=erroru popuperr ptest
 endif
 endif
@@ -571,6 +575,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 endif
 endif
@@ -682,6 +689,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 override COMPILER_TARGETDIR+=$(TARGETSUFFIX)
 endif
 endif
@@ -943,6 +953,12 @@ SHAREDLIBEXT=.dll
 SHORTSUFFIX=wat
 SHORTSUFFIX=wat
 IMPORTLIBPREFIX=
 IMPORTLIBPREFIX=
 endif
 endif
+ifeq ($(OS_TARGET),android)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 BATCHEXT=.sh
 BATCHEXT=.sh
 EXEEXT=
 EXEEXT=
@@ -1072,18 +1088,6 @@ BATCHEXT=.sh
 EXEEXT=
 EXEEXT=
 SHORTSUFFIX=aix
 SHORTSUFFIX=aix
 endif
 endif
-ifeq ($(OS_TARGET),java)
-OEXT=.class
-ASMEXT=.j
-SHAREDLIBEXT=.jar
-SHORTSUFFIX=java
-endif
-ifeq ($(OS_TARGET),android)
-OEXT=.class
-ASMEXT=.j
-SHAREDLIBEXT=.jar
-SHORTSUFFIX=android
-endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
@@ -1437,12 +1441,17 @@ endif
 endif
 endif
 ifdef CREATESHARED
 ifdef CREATESHARED
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
 endif
 endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
 ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifeq ($(CPU_TARGET),x86_64)
 ifeq ($(CPU_TARGET),x86_64)
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
 endif
 endif
 endif
 endif
+endif
 ifdef LINKSHARED
 ifdef LINKSHARED
 endif
 endif
 ifdef OPT
 ifdef OPT
@@ -1667,6 +1676,96 @@ endif
 fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
 fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifdef TARGET_DIRS_TARGET_DIRS
+TARGET_DIRS_all:
+	$(MAKE) -C TARGET_DIRS all
+TARGET_DIRS_debug:
+	$(MAKE) -C TARGET_DIRS debug
+TARGET_DIRS_smart:
+	$(MAKE) -C TARGET_DIRS smart
+TARGET_DIRS_release:
+	$(MAKE) -C TARGET_DIRS release
+TARGET_DIRS_units:
+	$(MAKE) -C TARGET_DIRS units
+TARGET_DIRS_examples:
+	$(MAKE) -C TARGET_DIRS examples
+TARGET_DIRS_shared:
+	$(MAKE) -C TARGET_DIRS shared
+TARGET_DIRS_install:
+	$(MAKE) -C TARGET_DIRS install
+TARGET_DIRS_sourceinstall:
+	$(MAKE) -C TARGET_DIRS sourceinstall
+TARGET_DIRS_exampleinstall:
+	$(MAKE) -C TARGET_DIRS exampleinstall
+TARGET_DIRS_distinstall:
+	$(MAKE) -C TARGET_DIRS distinstall
+TARGET_DIRS_zipinstall:
+	$(MAKE) -C TARGET_DIRS zipinstall
+TARGET_DIRS_zipsourceinstall:
+	$(MAKE) -C TARGET_DIRS zipsourceinstall
+TARGET_DIRS_zipexampleinstall:
+	$(MAKE) -C TARGET_DIRS zipexampleinstall
+TARGET_DIRS_zipdistinstall:
+	$(MAKE) -C TARGET_DIRS zipdistinstall
+TARGET_DIRS_clean:
+	$(MAKE) -C TARGET_DIRS clean
+TARGET_DIRS_distclean:
+	$(MAKE) -C TARGET_DIRS distclean
+TARGET_DIRS_cleanall:
+	$(MAKE) -C TARGET_DIRS cleanall
+TARGET_DIRS_info:
+	$(MAKE) -C TARGET_DIRS info
+TARGET_DIRS_makefiles:
+	$(MAKE) -C TARGET_DIRS makefiles
+TARGET_DIRS:
+	$(MAKE) -C TARGET_DIRS all
+.PHONY: TARGET_DIRS_all TARGET_DIRS_debug TARGET_DIRS_smart TARGET_DIRS_release TARGET_DIRS_units TARGET_DIRS_examples TARGET_DIRS_shared TARGET_DIRS_install TARGET_DIRS_sourceinstall TARGET_DIRS_exampleinstall TARGET_DIRS_distinstall TARGET_DIRS_zipinstall TARGET_DIRS_zipsourceinstall TARGET_DIRS_zipexampleinstall TARGET_DIRS_zipdistinstall TARGET_DIRS_clean TARGET_DIRS_distclean TARGET_DIRS_cleanall TARGET_DIRS_info TARGET_DIRS_makefiles TARGET_DIRS
+endif
+ifdef TARGET_EXAMPLEDIRS_TARGET_EXAMPLEDIRS
+TARGET_EXAMPLEDIRS_all:
+	$(MAKE) -C TARGET_EXAMPLEDIRS all
+TARGET_EXAMPLEDIRS_debug:
+	$(MAKE) -C TARGET_EXAMPLEDIRS debug
+TARGET_EXAMPLEDIRS_smart:
+	$(MAKE) -C TARGET_EXAMPLEDIRS smart
+TARGET_EXAMPLEDIRS_release:
+	$(MAKE) -C TARGET_EXAMPLEDIRS release
+TARGET_EXAMPLEDIRS_units:
+	$(MAKE) -C TARGET_EXAMPLEDIRS units
+TARGET_EXAMPLEDIRS_examples:
+	$(MAKE) -C TARGET_EXAMPLEDIRS examples
+TARGET_EXAMPLEDIRS_shared:
+	$(MAKE) -C TARGET_EXAMPLEDIRS shared
+TARGET_EXAMPLEDIRS_install:
+	$(MAKE) -C TARGET_EXAMPLEDIRS install
+TARGET_EXAMPLEDIRS_sourceinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS sourceinstall
+TARGET_EXAMPLEDIRS_exampleinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS exampleinstall
+TARGET_EXAMPLEDIRS_distinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS distinstall
+TARGET_EXAMPLEDIRS_zipinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipinstall
+TARGET_EXAMPLEDIRS_zipsourceinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipsourceinstall
+TARGET_EXAMPLEDIRS_zipexampleinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipexampleinstall
+TARGET_EXAMPLEDIRS_zipdistinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipdistinstall
+TARGET_EXAMPLEDIRS_clean:
+	$(MAKE) -C TARGET_EXAMPLEDIRS clean
+TARGET_EXAMPLEDIRS_distclean:
+	$(MAKE) -C TARGET_EXAMPLEDIRS distclean
+TARGET_EXAMPLEDIRS_cleanall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS cleanall
+TARGET_EXAMPLEDIRS_info:
+	$(MAKE) -C TARGET_EXAMPLEDIRS info
+TARGET_EXAMPLEDIRS_makefiles:
+	$(MAKE) -C TARGET_EXAMPLEDIRS makefiles
+TARGET_EXAMPLEDIRS:
+	$(MAKE) -C TARGET_EXAMPLEDIRS all
+.PHONY: TARGET_EXAMPLEDIRS_all TARGET_EXAMPLEDIRS_debug TARGET_EXAMPLEDIRS_smart TARGET_EXAMPLEDIRS_release TARGET_EXAMPLEDIRS_units TARGET_EXAMPLEDIRS_examples TARGET_EXAMPLEDIRS_shared TARGET_EXAMPLEDIRS_install TARGET_EXAMPLEDIRS_sourceinstall TARGET_EXAMPLEDIRS_exampleinstall TARGET_EXAMPLEDIRS_distinstall TARGET_EXAMPLEDIRS_zipinstall TARGET_EXAMPLEDIRS_zipsourceinstall TARGET_EXAMPLEDIRS_zipexampleinstall TARGET_EXAMPLEDIRS_zipdistinstall TARGET_EXAMPLEDIRS_clean TARGET_EXAMPLEDIRS_distclean TARGET_EXAMPLEDIRS_cleanall TARGET_EXAMPLEDIRS_info TARGET_EXAMPLEDIRS_makefiles TARGET_EXAMPLEDIRS
+endif
 debug:
 debug:
 smart:
 smart:
 release:
 release:

+ 39 - 16
tests/utils/dotest.pp

@@ -19,6 +19,7 @@
 
 
 program dotest;
 program dotest;
 uses
 uses
+  sysutils,
   dos,
   dos,
 {$ifdef macos}
 {$ifdef macos}
   macutils,
   macutils,
@@ -92,6 +93,7 @@ const
   ExtraCompilerOpts : string = '';
   ExtraCompilerOpts : string = '';
   DelExecutable : TDelExecutables = [];
   DelExecutable : TDelExecutables = [];
   RemoteAddr : string = '';
   RemoteAddr : string = '';
+  RemotePathPrefix : string = '';
   RemotePath : string = '/tmp';
   RemotePath : string = '/tmp';
   RemotePara : string = '';
   RemotePara : string = '';
   RemoteRshParas : string = '';
   RemoteRshParas : string = '';
@@ -100,7 +102,7 @@ const
   RemoteShellNeedsExport : boolean = false;
   RemoteShellNeedsExport : boolean = false;
   rshprog : string = 'rsh';
   rshprog : string = 'rsh';
   rcpprog : string = 'rcp';
   rcpprog : string = 'rcp';
-  rquote : char = '''';
+  rquote : string = '''';
   UseTimeout : boolean = false;
   UseTimeout : boolean = false;
   emulatorname : string = '';
   emulatorname : string = '';
   TargetCanCompileLibraries : boolean = true;
   TargetCanCompileLibraries : boolean = true;
@@ -610,10 +612,9 @@ end;
 procedure SetTargetDirectoriesStyle;
 procedure SetTargetDirectoriesStyle;
 var
 var
   LTarget : string;
   LTarget : string;
-  res : boolean;
 begin
 begin
   { Call this first to ensure that CompilerTarget is not empty }
   { Call this first to ensure that CompilerTarget is not empty }
-  res:=GetCompilerTarget;
+  GetCompilerTarget;
   LTarget := CompilerTarget;
   LTarget := CompilerTarget;
   TargetHasDosStyleDirectories :=
   TargetHasDosStyleDirectories :=
     (LTarget='emx') or
     (LTarget='emx') or
@@ -672,10 +673,9 @@ end;
 procedure SetUseOSOnly;
 procedure SetUseOSOnly;
 var
 var
   LTarget : string;
   LTarget : string;
-  res : boolean;
 begin
 begin
   { Call this first to ensure that CompilerTarget is not empty }
   { Call this first to ensure that CompilerTarget is not empty }
-  res:=GetCompilerTarget;
+  GetCompilerTarget;
   LTarget := CompilerTarget;
   LTarget := CompilerTarget;
   UseOSOnly:= (LTarget='emx') or
   UseOSOnly:= (LTarget='emx') or
               (LTarget='go32v2') or
               (LTarget='go32v2') or
@@ -686,10 +686,9 @@ end;
 procedure SetTargetCanCompileLibraries;
 procedure SetTargetCanCompileLibraries;
 var
 var
   LTarget : string;
   LTarget : string;
-  res : boolean;
 begin
 begin
   { Call this first to ensure that CompilerTarget is not empty }
   { Call this first to ensure that CompilerTarget is not empty }
-  res:=GetCompilerTarget;
+  GetCompilerTarget;
   LTarget := CompilerTarget;
   LTarget := CompilerTarget;
   { Feel free to add other targets here }
   { Feel free to add other targets here }
   if (LTarget='go32v2') then
   if (LTarget='go32v2') then
@@ -1237,7 +1236,7 @@ begin
     ExecuteRemote(rshprog,RemoteRshParas+' rm -f '+TestRemoteExe,
     ExecuteRemote(rshprog,RemoteRshParas+' rm -f '+TestRemoteExe,
                   StartTicks,EndTicks);
                   StartTicks,EndTicks);
   execres:=ExecuteRemote(rcpprog,RemotePara+' '+FileToCopy+' '+
   execres:=ExecuteRemote(rcpprog,RemotePara+' '+FileToCopy+' '+
-                         RemoteAddr+':'+TestRemoteExe,StartTicks,EndTicks);
+                         RemotePathPrefix+TestRemoteExe,StartTicks,EndTicks);
   if not execres then
   if not execres then
   begin
   begin
     Verbose(V_normal, 'Could not copy executable '+FileToCopy);
     Verbose(V_normal, 'Could not copy executable '+FileToCopy);
@@ -1259,7 +1258,7 @@ begin
         else
         else
           pref:='';
           pref:='';
         execres:=ExecuteRemote(rcpprog,pref+RemotePara+' '+LocalFile+' '+
         execres:=ExecuteRemote(rcpprog,pref+RemotePara+' '+LocalFile+' '+
-                               RemoteAddr+':'+RemoteFile,StartTicks,EndTicks);
+                               RemotePathPrefix+RemoteFile,StartTicks,EndTicks);
         if not execres then
         if not execres then
         begin
         begin
           Verbose(V_normal, 'Could not copy required file '+LocalFile);
           Verbose(V_normal, 'Could not copy required file '+LocalFile);
@@ -1493,6 +1492,7 @@ procedure getargs;
     writeln('Options can be:');
     writeln('Options can be:');
     writeln('  !ENV_NAME     parse environment variable ENV_NAME for options');
     writeln('  !ENV_NAME     parse environment variable ENV_NAME for options');
     writeln('  -A            include ALL tests');
     writeln('  -A            include ALL tests');
+    writeln('  -ADB          use ADB to run tests');
     writeln('  -B            delete executable before remote upload');
     writeln('  -B            delete executable before remote upload');
     writeln('  -C<compiler>  set compiler to use');
     writeln('  -C<compiler>  set compiler to use');
     writeln('  -D            display execution time');
     writeln('  -D            display execution time');
@@ -1527,12 +1527,21 @@ procedure getargs;
     delete(para,1,2);
     delete(para,1,2);
     case ch of
     case ch of
      'A' :
      'A' :
-       begin
-         DoGraph:=true;
-         DoInteractive:=true;
-         DoKnown:=true;
-         DoAll:=true;
-       end;
+       if UpperCase(para) = 'DB' then
+         begin
+           rshprog:='adb';
+           rcpprog:='adb';
+           rquote:='';
+           if RemoteAddr = '' then
+             RemoteAddr:='1'; // fake remote addr (default device will be used)
+         end
+       else
+         begin
+           DoGraph:=true;
+           DoInteractive:=true;
+           DoKnown:=true;
+           DoAll:=true;
+         end;
 
 
      'B' : Include(DelExecutable,deBefore);
      'B' : Include(DelExecutable,deBefore);
 
 
@@ -1672,7 +1681,21 @@ begin
   if (rshprog='plink') and (pos('-load',RemotePara)>0) then
   if (rshprog='plink') and (pos('-load',RemotePara)>0) then
     RemoteRshParas:=RemotePara
     RemoteRshParas:=RemotePara
   else
   else
-    RemoteRshParas:=RemotePara+' '+RemoteAddr;
+    if rshprog='adb' then
+      begin
+        if RemoteAddr <> '1' then
+          RemotePara:=Trim('-s ' + RemoteAddr + ' ' + RemotePara);
+        RemoteRshParas:=Trim(RemotePara + ' shell');
+      end
+    else
+      RemoteRshParas:=RemotePara+' '+RemoteAddr;
+  if rcpprog = 'adb' then
+    begin
+      RemotePathPrefix:='';
+      RemotePara:=Trim(RemotePara + ' push');
+    end
+  else
+    RemotePathPrefix:=RemoteAddr + ':';
 end;
 end;