Index: src/tests/.expect/ScopeErrors.txt
===================================================================
--- src/tests/.expect/ScopeErrors.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
+++ src/tests/.expect/ScopeErrors.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -0,0 +1,11 @@
+CFA Version 1.0.0 (debug)
+Error: duplicate object definition for thisIsAnError: signed int
+Error: duplicate function definition for butThisIsAnError: function
+  with parameters
+    double
+  returning 
+    double
+  with body 
+    CompoundStmt
+
+make: *** [ScopeErrors] Error 1
Index: src/tests/.expect/abs.txt
===================================================================
--- src/tests/.expect/abs.txt	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/.expect/abs.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -1,4 +1,2 @@
-/usr/local/bin/cfa -g -Wall -Wno-unused-function     abs.c   -o abs
-CFA Version 1.0.0 (debug)
 char			¿	abs A
 signed int		-65	abs 65
Index: src/tests/.expect/ato.txt
===================================================================
--- src/tests/.expect/ato.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
+++ src/tests/.expect/ato.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -0,0 +1,13 @@
+-123 -123
+123 123
+-123 -123
+123 123
+-123 -123
+123 123
+-123.456 -123.456
+-123.456789012346 -123.4567890123456
+-123.456789012345679 -123.45678901234567890123456789
+-123.456-123.456i -123.456-123.456i
+-123.456789012346+123.456789012346i -123.4567890123456+123.4567890123456i
+123.456789012345679-123.456789012345679i 123.45678901234567890123456789-123.45678901234567890123456789i
+123.45678901234-123.456789i 123.45678901234-123.4567890i
Index: src/tests/.expect/io.txt
===================================================================
--- src/tests/.expect/io.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
+++ src/tests/.expect/io.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -0,0 +1,26 @@
+9 6 28 0 7 1 2
+1 2 3
+123
+123
+
+A 
+1 2 3 4 5 6 7 8
+1.1 1.2 1.3
+1.1+2.3i 1.1-2.3i 1.1-2.3i
+
+1.11.21.3
+1.1+2.3i1.1-2.3i1.1-2.3i
+ abcxyz
+abcxyz
+
+1.1, $1.2, $1.3
+1.1+2.3i, $1.1-2.3i, $1.1-2.3i
+abc, $xyz
+
+v(27 v[27 v{27 $27 £27 ¥27 ¡27 ¿27 «27
+25, 25. 25: 25; 25! 25? 25) 25] 25} 25% 25¢ 25»
+25'27 25`27 25"27 25 27 25
+27 25
+27 25
+27 25	27 25
+27
Index: src/tests/.expect/math.txt
===================================================================
--- src/tests/.expect/math.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
+++ src/tests/.expect/math.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -0,0 +1,59 @@
+fabs: 1 1 1 1.41421 1.41421356237309505 1.41421356237309505
+fmod: 1 1 1 1 1 1
+remainder: -1 -1 -1
+remquo: 7 0.0999999 7 0.1 7 0.0999999999999999999
+div: 7 0.0999999 7 0.1 7 0.0999999999999999999
+fma: -2 -2 -2
+fdim: 2 2 2
+nan: nan nan nan
+exp: 2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
+exp2: 2 2 2
+expm1: 1.71828 1.71828182845905 1.71828182845904524
+log: 0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
+log2: 3 3 3
+log10: 2 2 2
+log1p: 0.693147 0.693147180559945 0.693147180559945309
+ilogb: 0 0 0
+logb: 3 3 3
+sqrt: 1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
+cbrt: 3 3 3
+hypot: 1.41421 1.4142135623731 1.41421356237309505
+pow: 1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
+sin: 0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
+cos: 0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
+tan: 1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
+asin: 1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
+acos: 0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
+atan: 0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
+atan2: 0.785398 0.785398163397448 0.78539816339744831 atan: 0.785398 0.785398163397448 0.78539816339744831 sinh: 1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i
+cosh: 1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
+tanh: 0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
+acosh: 0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
+asinh: 0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
+atanh: inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
+erf: 0.842701 0.842700792949715 0.842700792949714869
+erfc: 0.157299 0.157299207050285 0.157299207050285131
+lgamma: 1.79176 1.79175946922805 1.791759469228055
+lgamma: 1.79176 1 1.79175946922805 1 1.791759469228055 1
+tgamma: 6 6 6
+floor: 1 1 1
+ceil: 2 2 2
+trunc: 3 3 3
+rint: 2 2 2
+rint: 2 2 2
+rint: 2 2 2
+lrint: 2 2 2
+llrint: 2 2 2
+nearbyint: 4 4 4
+round: 2 2 2
+round: 2 2 2
+round: 2 2 2
+lround: 2 2 2
+llround: 2 2 2
+copysign: -1 -1 -1
+frexp: 0.5 3 0.5 3 0.5 3
+ldexp: 8 8 8
+modf: 2 0.3 2 0.3 2 0.3 nextafter: 2 2 2
+nexttoward: 2 2 2
+scalbn: 16 16 16
+scalbln: 16 16 16
Index: src/tests/.expect/minmax.txt
===================================================================
--- src/tests/.expect/minmax.txt	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/.expect/minmax.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -0,0 +1,21 @@
+char			z a	min a
+signed int		4 3	min 3
+unsigned int		4 3	min 3
+signed long int		4 3	min 3
+unsigned long int	4 3	min 3
+signed long long int	4 3	min 3
+unsigned long long int	4 3	min 3
+float			4 3.1	min 3.1
+double			4 3.1	min 3.1
+long double		4 3.1	min 3.1
+
+char			z a	max z
+signed int		4 3	max 4
+unsigned int		4 3	max 4
+signed long int		4 3	max 4
+unsigned long int	4 3	max 4
+signed long long int	4 3	max 4
+unsigned long long int	4 3	max 4
+float			4 3.1	max 4
+double			4 3.1	max 4
+long double		4 3.1	max 4
Index: src/tests/.expect/swap.txt
===================================================================
--- src/tests/.expect/swap.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
+++ src/tests/.expect/swap.txt	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -0,0 +1,14 @@
+char			a b			swap 	b a
+signed int		-1 -2			swap 	-2 -1
+unsigned int		1 2			swap 	2 1
+signed long int		-1 -2			swap 	-2 -1
+unsigned long int	1 2			swap 	2 1
+signed long long int	-1 -2			swap 	-2 -1
+unsigned long long int	1 2			swap 	2 1
+float			1.5 2.5			swap 	2.5 1.5
+double			1.5 2.5			swap 	2.5 1.5
+long double		1.5 2.5			swap 	2.5 1.5
+float _Complex		1.5+1.5i 2.5+2.5i	swap 	2.5+2.5i 1.5+1.5i
+double _Complex		1.5+1.5i 2.5+2.5i	swap 	2.5+2.5i 1.5+1.5i
+long double _Complex	1.5+1.5i 2.5+2.5i	swap 	2.5+2.5i 1.5+1.5i
+struct S		1 2, 2 1		swap 	2 1, 1 2
Index: src/tests/Context.c
===================================================================
--- src/tests/Context.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Context.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -1,3 +1,4 @@
 // trait declaration
+
 trait has_q( otype T ) {
 	T q( T );
Index: src/tests/Forall.c
===================================================================
--- src/tests/Forall.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Forall.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -10,10 +10,10 @@
 	void f( int );
 	void h( void (*p)(void) );
-  
+
 	int x;
 	void (*y)(void);
 	char z;
 	float w;
-  
+
 	f( x );
 	f( y );
@@ -26,10 +26,10 @@
 	forall( otype T ) void f( T, T );
 	forall( otype T, otype U ) void f( T, U );
-  
+
 	int x;
 	float y;
 	int *z;
 	float *w;
-  
+
 	f( x, y );
 	f( z, w );
Index: src/tests/Operators.c
===================================================================
--- src/tests/Operators.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Operators.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -1,3 +1,5 @@
-int ?*?( int, int );
+int ?*?( int a, int b ) {
+	return 0;
+}
 
 int ?()( int number1, int number2 ) {
@@ -5,12 +7,18 @@
 }
 
-int ?+?( int, int );
+int ?+?( int a, int b ) {
+	return 0;
+}
 
-int ?=?( int *, int );
+int ?=?( int *a, int b ) {
+	return 0;
+}
 struct accumulator {
 	int total;
 };
 
-char ?()( struct accumulator a, char number1, char number2 );
+char ?()( struct accumulator a, char number1, char number2 ) {
+	return 'a';
+}
 
 void f( void ) {
@@ -23,4 +31,9 @@
 }
 
+int main(int argc, char const *argv[]) {
+	/* code */
+	return 0;
+}
+
 // Local Variables: //
 // tab-width: 4 //
Index: src/tests/Scope.c
===================================================================
--- src/tests/Scope.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Scope.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -15,5 +15,5 @@
 y p;
 
-context has_u( otype z ) {
+trait has_u( otype z ) {
 	z u(z);
 };
Index: src/tests/Subrange.c
===================================================================
--- src/tests/Subrange.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Subrange.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -1,5 +1,5 @@
 // A small context defining the notion of an ordered otype.  (The standard
 // library should probably contain a context for this purpose.)
-context ordered(otype T) {
+trait ordered(otype T) {
     int ?<?(T, T), ?<=?(T, T);
 };
Index: src/tests/Switch.c
===================================================================
--- src/tests/Switch.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Switch.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -1,3 +1,3 @@
-int fred() {
+int main(int argc, char const *argv[]) {
     int i;
     switch ( i ) case 3 : i = 1;
Index: src/tests/Typedef.c
===================================================================
--- src/tests/Typedef.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/Typedef.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -18,5 +18,5 @@
 a c;
 
-typedef otypeof(3) x, y;  // GCC
+typedef typeof(3) x, y;  // GCC
 
 x p;
@@ -24,5 +24,5 @@
 
 int main() {
-    typedef otypeof(3) z, p;
+    typedef typeof(3) z, p;
     z w;
     p x;
Index: src/tests/limits.c
===================================================================
--- src/tests/limits.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/limits.c	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// limits.c -- 
+// limits.c --
 //
 // Author           : Peter A. Buhr
@@ -12,5 +12,5 @@
 // Last Modified On : Tue May 10 20:45:28 2016
 // Update Count     : 1
-// 
+//
 
 #include <limits>
@@ -109,4 +109,9 @@
 long _Complex _1_sqrt_2 = _1_SQRT_2;
 
+int main(int argc, char const *argv[]) {
+	//DUMMY
+	return 0;
+}
+
 // Local Variables: //
 // tab-width: 4 //
Index: src/tests/poly-bench.c
===================================================================
--- src/tests/poly-bench.c	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ 	(revision )
@@ -1,207 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// poly-bench.cc -- 
-//
-// Author           : Aaron Moss
-// Created On       : Sat May 16 07:26:30 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Wed May 27 18:25:19 2015
-// Update Count     : 5
-//
-
-extern "C" {
-#include <stdio.h>
-//#include "my_time.h"
-}
-
-#define N 200000000
-
-struct ipoint {
-	int x;
-	int y;
-};
-
-struct ipoint ?+?(struct ipoint a, struct ipoint b) {
-	struct ipoint r;
-	r.x = a.x + b.x;
-	r.y = a.y + b.y;
-	return r;
-}
-
-struct ipoint ?-?(struct ipoint a, struct ipoint b) {
-	struct ipoint r;
-	r.x = a.x - b.x;
-	r.y = a.y - b.y;
-	return r;
-}
-
-struct ipoint ?*?(struct ipoint a, struct ipoint b) {
-	struct ipoint r;
-	r.x = a.x * b.x;
-	r.y = a.y * b.y;
-	return r;
-}
-
-struct dpoint {
-	double x;
-	double y;
-};
-
-struct dpoint ?+?(struct dpoint a, struct dpoint b) {
-	struct dpoint r;
-	r.x = a.x + b.x;
-	r.y = a.y + b.y;
-	return r;
-}
-
-struct dpoint ?-?(struct dpoint a, struct dpoint b) {
-	struct dpoint r;
-	r.x = a.x - b.x;
-	r.y = a.y - b.y;
-	return r;
-}
-
-struct dpoint ?*?(struct dpoint a, struct dpoint b) {
-	struct dpoint r;
-	r.x = a.x * b.x;
-	r.y = a.y * b.y;
-	return r;
-}
-
-int a2b2_mono_int(int a, int b) {
-	return (a - b)*(a + b);
-}
-
-double a2b2_mono_double(double a, double b) {
-	return (a - b)*(a + b);
-}
-
-struct ipoint a2b2_mono_ipoint(struct ipoint a, struct ipoint b) {
-	return (a - b)*(a + b);
-}
-
-struct dpoint a2b2_mono_dpoint(struct dpoint a, struct dpoint b) {
-	return (a - b)*(a + b);
-}
-
-forall(type T | { T ?+?(T,T); T ?-?(T,T); T ?*?(T,T); })
-T a2b2_poly(T a, T b) {
-	return (a - b)*(a + b);
-}
-
-typedef int clock_t;
-long ms_between(clock_t start, clock_t end) {
-//	return (end - start) / (CLOCKS_PER_SEC / 1000);
-	return 0;
-}
-int clock() { return 3; }
-
-int main(int argc, char** argv) {
-	clock_t start, end;
-	int i;
-	
-	int a, b;
-	double c, d;
-	struct ipoint p, q;
-	struct dpoint r, s;
-	
-	printf("\n## a^2-b^2 ##\n");
-	
-	a = 5, b = 3;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		a = a2b2_mono_int(a, b);
-		b = a2b2_mono_int(b, a);
-	}
-	end = clock();
-	printf("mono_int:   %7ld  [%d,%d]\n", ms_between(start, end), a, b);
-	
-	a = 5, b = 3;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		a = a2b2_poly(a, b);
-		b = a2b2_poly(b, a);
-	}
-	end = clock();
-	printf("poly_int:   %7ld  [%d,%d]\n", ms_between(start, end), a, b);
-	
-/*	{
-	a = 5, b = 3;
-	// below doesn't actually work; a2b2_poly isn't actually assigned, just declared
-	* [int] (int, int) a2b2_poly = a2b2_mono_int;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-//			printf("\t[%d,%d]\n", a, b);
-a = a2b2_poly(a, b);
-//			printf("\t[%d,%d]\n", a, b);
-b = a2b2_poly(b, a);
-}
-end = clock();
-printf("spec_int:   %7ld  [%d,%d]\n", ms_between(start, end), a, b);
-}
-*/	
-	c = 5.0, d = 3.0;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		c = a2b2_mono_double(c, d);
-		d = a2b2_mono_double(d, c);
-	}
-	end = clock();
-	printf("mono_double:%7ld  [%f,%f]\n", ms_between(start, end), c, d);
-		
-	c = 5.0, d = 3.0;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		c = a2b2_poly(c, d);
-		d = a2b2_poly(d, c);
-	}
-	end = clock();
-	printf("poly_double:%7ld  [%f,%f]\n", ms_between(start, end), c, d);
-	
-	p.x = 5, p.y = 5, q.x = 3, q.y = 3;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		p = a2b2_mono_ipoint(p, q);
-		q = a2b2_mono_ipoint(q, p);
-	}
-	end = clock();
-	printf("mono_ipoint:%7ld  [(%d,%d),(%d,%d)]\n", ms_between(start, end), p.x, p.y, q.x, q.y);
-		
-	p.x = 5, p.y = 5, q.x = 3, q.y = 3;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		p = a2b2_poly(p, q);
-		q = a2b2_poly(q, p);
-	}
-	end = clock();
-	printf("poly_ipoint:%7ld  [(%d,%d),(%d,%d)]\n", ms_between(start, end), p.x, p.y, q.x, q.y);
-	
-	r.x = 5.0, r.y = 5.0, s.x = 3.0, s.y = 3.0;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		r = a2b2_mono_dpoint(r, s);
-		s = a2b2_mono_dpoint(s, r);
-	}
-	end = clock();
-	printf("mono_dpoint:%7ld  [(%f,%f),(%f,%f)]\n", ms_between(start, end), r.x, r.y, s.x, s.y);
-		
-	r.x = 5.0, r.y = 5.0, s.x = 3.0, s.y = 3.0;
-	start = clock();
-	for (i = 0; i < N/2; ++i) {
-		r = a2b2_poly(r, s);
-		s = a2b2_poly(s, r);
-	}
-	end = clock();
-	printf("poly_dpoint:%7ld  [(%f,%f),(%f,%f)]\n", ms_between(start, end), r.x, r.y, s.x, s.y);
-
-	return 0;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa poly-bench.c" //
-// End: //
Index: src/tests/test.py
===================================================================
--- src/tests/test.py	(revision a0dcd2edcadf2ff42b6ab01a0c906832947262c0)
+++ src/tests/test.py	(revision 554a0dba687f5fe1c810207608c083be214d1276)
@@ -3,5 +3,5 @@
 
 from os import listdir
-from os.path import isfile, join
+from os.path import isfile, join, splitext
 from subprocess import Popen, PIPE, STDOUT
 
@@ -13,8 +13,7 @@
 ################################################################################
 def listTests():
-	list = [f.rstrip('.c') for f in listdir('.')
-		if not f.startswith('.') and (
-			not isfile(f) or f.endswith('.c')
-		)]
+	list = [splitext(f)[0] for f in listdir('./.expect')
+		if not f.startswith('.') and f.endswith('.txt')
+		]
 
 	return list
@@ -40,5 +39,5 @@
 
 	# build, skipping to next test on error
-	make_ret = sh("make -j 8 %s > %s 2>&1" % (test, out_file), dry_run)
+	make_ret = sh("make -j 8 %s 2> %s 1> /dev/null" % (test, out_file), dry_run)
 
 	if make_ret == 0 :
@@ -51,7 +50,4 @@
 	retcode = 0
 	if not generate :
-		# touch expected files so empty output are supported by default
-		sh("touch .expect/%s.txt" % test, dry_run)
-
 		# diff the output of the files
 		retcode = sh("diff .expect/%s.txt .out/%s.log" % (test, test), dry_run)
@@ -67,11 +63,9 @@
 
 	if generate :
-		print( "Regenerate tests for: ", end="" )
-		print( ", ".join( tests ) )
+		print( "Regenerate tests for: " )
 
 	failed = False;
 	for t in tests:
-		if not generate :
-			print("%20s  " % t, end="")
+		print("%20s  " % t, end="")
 		sys.stdout.flush()
 		test_failed = run_test_instance(t, generate, dry_run)
@@ -80,9 +74,8 @@
 		if not generate :
 			print("FAILED" if test_failed else "PASSED")
+		else :
+			print( "Done" )
 
 	sh('make clean > /dev/null 2>&1', dry_run)
-
-	if generate :
-		print( "Done" )
 
 	return 0 if failed else 1
@@ -93,16 +86,37 @@
 parser = argparse.ArgumentParser(description='Script which runs cforall tests')
 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
+parser.add_argument('--list', help='List all test available', action='store_true')
 parser.add_argument('--all', help='Run all test available', action='store_true')
-parser.add_argument('--generate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
+parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
 parser.add_argument('tests', metavar='test', type=str, nargs='*', help='a list of tests to run')
 
 options = parser.parse_args()
 
-if len(options.tests) > 0 and options.all :
+if (len(options.tests) > 0  and     options.all and not options.list) \
+or (len(options.tests) == 0 and not options.all and not options.list) :
 	print('ERROR: must have option \'--all\' or non-empty test list', file=sys.stderr)
 	parser.print_help()
 	sys.exit(1)
 
-tests = listTests() if options.all else options.tests
+allTests = listTests()
 
-sys.exit( run_tests(tests, options.generate_expected, options.dry_run) )
+if options.all or options.list :
+	tests = allTests
+
+else :
+	tests = []
+	for test in options.tests:
+		if test in allTests :
+			tests.append(test)
+		else :
+			print('ERROR: No expected file for test %s, ignoring it' % test, file=sys.stderr)
+
+	if len(tests) == 0 :
+		print('ERROR: No valid test to run', file=sys.stderr)
+		sys.exit(1)
+
+if options.list :
+	print("\n".join(tests))
+
+else :
+	sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run) )
