Index: tests/test.py
===================================================================
--- tests/test.py	(revision 99581ee3ebb93015c6498c2976cbb8fcb21c84b6)
+++ tests/test.py	(revision 54dcab16a65ef7e9617720bda2909ad715e5b8cc)
@@ -24,10 +24,20 @@
 
 	def match_test(path):
-		match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path)
+		match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.nast|\.oast)?(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path)
 		if match :
 			test = Test()
 			test.name = match.group(2)
 			test.path = match.group(1)
-			test.arch = match.group(3)[1:] if match.group(3) else None
+			test.arch = match.group(4)[1:] if match.group(4) else None
+
+			astv = match.group(3)[1:] if match.group(3) else None
+			if astv == 'oast':
+				test.astv = 'old'
+			elif astv == 'nast':
+				test.astv = 'new'
+			elif astv:
+				print('ERROR: "%s", expect file has astv but it is not "nast" or "oast"' % testname, file=sys.stderr)
+				sys.exit(1)
+
 			expected.append(test)
 
@@ -66,30 +76,34 @@
 	if options.regenerate_expected :
 		for testname in options.tests :
-			testname = canonical_path( testname )
+			testname = os.path.normpath( os.path.join(settings.SRCDIR, testname) )
+
 			# first check if this is a valid name to regenerate
 			if Test.valid_name(testname):
 				# this is a valid name, let's check if it already exists
 				found = [test for test in all_tests if canonical_path( test.target() ) == testname]
+				setup = itertools.product(settings.all_arch if options.arch else [None], settings.all_ast if options.ast else [None])
 				if not found:
-					# it's a new name, create it according to the name and specified architecture
-					if options.arch:
-						# user specified one or multiple architectures, assume the tests will have architecture specific results
-						tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
-					else:
-						# user didn't specify an architecture, just create a cross platform test
-						tests.append( Test.new_target( testname, None ) )
+					# it's a new name, create it according to the name and specified architecture/ast version
+					tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] )
 				elif len(found) == 1 and not found[0].arch:
 					# we found a single test, the user better be wanting to create a cross platform test
 					if options.arch:
 						print('ERROR: "%s", test has no specified architecture but --arch was specified, ignoring it' % testname, file=sys.stderr)
+					elif options.ast:
+						print('ERROR: "%s", test has no specified ast version but --ast was specified, ignoring it' % testname, file=sys.stderr)
 					else:
 						tests.append( found[0] )
 				else:
 					# this test is already cross platform, just add a test for each platform the user asked
-					tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
+					tests.extend( [Test.new_target(testname, arch, ast) for arch, ast in setup] )
 
 					# print a warning if it users didn't ask for a specific architecture
 					if not options.arch:
 						print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr)
+
+
+					# print a warning if it users didn't ask for a specific ast version
+					if not options.ast:
+						print('WARNING: "%s", test has ast version specific expected files but --ast was not specified, regenerating only for current ast' % testname, file=sys.stderr)
 
 			else :
@@ -252,8 +266,8 @@
 	except KeyboardInterrupt:
 		return False, ""
-	except Exception as ex:
-		print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
-		sys.stderr.flush()
-		return False, ""
+	# except Exception as ex:
+	# 	print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
+	# 	sys.stderr.flush()
+	# 	return False, ""
 
 
@@ -371,5 +385,6 @@
 				# filter out the tests for a different architecture
 				# tests are the same across debug/install
-				local_tests = settings.arch.filter( tests )
+				local_tests = settings.ast.filter( tests )
+				local_tests = settings.arch.filter( local_tests )
 				options.jobs, forceJobs = job_count( options, local_tests )
 				settings.update_make_cmd(forceJobs, options.jobs)
@@ -383,8 +398,11 @@
 					len(local_tests),
 					options.jobs,
+					settings.ast.string,
 					settings.arch.string,
-					settings.debug.string,
-					settings.ast.string
+					settings.debug.string
 				))
+				if not local_tests :
+					print('WARNING: No tests for this configuration')
+					continue
 
 				# otherwise run all tests and make sure to return the correct error code
