Index: src/tests/pybin/settings.py
===================================================================
--- src/tests/pybin/settings.py	(revision 209383b99b1af12a23596f0f80bfb1394bcd3e06)
+++ src/tests/pybin/settings.py	(revision a02842f67b4ea1b878a2763ebc4f7d48787fe29e)
@@ -1,14 +1,54 @@
+import sys
 
 class Architecture:
-	def __init__(self, cmd):
-		if cmd:
+	KnownArchitectures = {
+		'x64'			: 'x64',
+		'x86-64'		: 'x64',
+		'x86'			: 'x86',
+		'i386'		: 'x86',
+		'i486'		: 'x86',
+		'i686'		: 'x86',
+		'Intel 80386'	: 'x86',
+		'arm'			: 'arm',
+		'ARM'			: 'arm',
+	}
+
+	def __init__(self, arch):
+		if arch:
 			self.cross_compile = True
-			self.target = cmd
+			try:
+				self.target = Architecture.makeCanonical( arch )
+			except KeyError:
+				print("Unkown architecture %s" % arch)
+				sys.exit(1)
 		else:
 			self.cross_compile = False
-			self.target = 'x64'
+			try:
+				arch = machine_default()
+				self.target = Architecture.makeCanonical( arch )
+			except KeyError:
+				print("Running on unkown architecture %s" % arch)
+				sys.exit(1)
 
-	def toString(self):
-		return self.target
+		self.string = self.target
+
+	def update(self):
+		if not self.cross_compile:
+			self.target = machine_default()
+			self.string = self.target
+			print("updated to %s" % self.target)
+
+	def match(self, arch):
+		return True if not arch else self.target == arch
+
+	@classmethod
+	def makeCanonical(_, arch):
+		return Architecture.KnownArchitectures[arch]
+
+
+class Debug:
+	def __init__(self, value):
+		self.string = "debug" if value else "no debug"
+		self.flags  = """DEBUG_FLAGS="%s" """ % ("-debug" if value else "-nodebug")
 
 def init( options ):
@@ -20,13 +60,18 @@
 	global debugFlag
 
-	arch       = Architecture(options.arch)
 	dry_run    = options.dry_run
 	generating = options.regenerate_expected
-	make       = './make_command_not_initialized'
-	debug	     = "debug" if options.debug else "no debug"
-	debugFlag  = """DEBUG_FLAGS="%s" """ % ("-debug" if debug else "-nodebug")
+	make       = 'make'
+	debug	     = Debug(options.debug)
+	arch       = Architecture(options.arch)
 
 def updateMakeCmd(force, jobs):
 	global make
 
-	make = "make" if force else ("make -j%i" % jobs)
+	make = "make" if not force else ("make -j%i" % jobs)
+
+
+def set_machine_default( func ):
+	global machine_default
+
+	machine_default = func
Index: src/tests/pybin/test_run.py
===================================================================
--- src/tests/pybin/test_run.py	(revision 209383b99b1af12a23596f0f80bfb1394bcd3e06)
+++ src/tests/pybin/test_run.py	(revision a02842f67b4ea1b878a2763ebc4f7d48787fe29e)
@@ -21,5 +21,5 @@
 
 	def expect(self):
-		return ("%s/.expect/%s.txt" % (self.path, self.name))
+		return ("%s/.expect/%s%s.txt" % (self.path, self.name, '' if not self.arch else ".%s" % self.arch))
 
 	def error_log(self):
@@ -39,9 +39,9 @@
 
 	@classmethod
-	def valid_name(cls, name):
+	def valid_name(_, name):
 		return not name.endswith( ('.c', '.cc', '.cpp', '.cfa') )
 
 	@classmethod
-	def from_target(cls, target):
+	def from_target(_, target):
 		test = Test()
 		test.name = os.path.basename(target)
Index: src/tests/pybin/tools.py
===================================================================
--- src/tests/pybin/tools.py	(revision 209383b99b1af12a23596f0f80bfb1394bcd3e06)
+++ src/tests/pybin/tools.py	(revision a02842f67b4ea1b878a2763ebc4f7d48787fe29e)
@@ -76,5 +76,5 @@
 		'-s' if silent else '',
 		test_param,
-		settings.debugFlag,
+		settings.debug.flags,
 		flags,
 		target,
@@ -147,5 +147,4 @@
 # parses the Makefile to find the machine type (32-bit / 64-bit)
 def getMachineType():
-	return 'x64'
 	sh('echo "void ?{}(int&a,int b){}int main(){return 0;}" > .dummy.c')
 	ret, out = make('.dummy', silent = True)
@@ -161,6 +160,8 @@
 	rm( (".dummy.c",".dummy") )
 
-	return out
-	return re.search("ELF\s([0-9]+)-bit", out).group(1)
+	if settings.dry_run :
+		return 'x64'
+
+	return re.search(r"[^,]+,([^,]+),", out).group(1).strip()
 
 # count number of jobs to create
@@ -213,2 +214,5 @@
 	raise argparse.ArgumentTypeError(msg)
 	return False
+
+
+settings.set_machine_default( getMachineType )
