Index: Jenkinsfile
===================================================================
--- Jenkinsfile	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ Jenkinsfile	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -33,5 +33,6 @@
 		dir ('src/tests') {
 			if (full_build) {
-				sh 'make all-tests'
+				sh 'make all-tests debug=yes'
+				sh 'make all-tests debug=no'
 			}
 			else {
Index: src/tests/.expect/castError.txt
===================================================================
--- src/tests/.expect/castError.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/castError.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: Can't choose between alternatives for expression Cast of:
   Name: f
Index: src/tests/.expect/constant0-1DP.txt
===================================================================
--- src/tests/.expect/constant0-1DP.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/constant0-1DP.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: duplicate object definition for 0: signed int
 Error: duplicate object definition for 0: const signed int
Index: src/tests/.expect/constant0-1NDDP.txt
===================================================================
--- src/tests/.expect/constant0-1NDDP.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/constant0-1NDDP.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: duplicate object definition for 0: signed int
 Error: duplicate object definition for 0: const signed int
Index: src/tests/.expect/declarationErrors.txt
===================================================================
--- src/tests/.expect/declarationErrors.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/declarationErrors.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: duplicate static in declaration of x1: static const volatile short int 
 
Index: src/tests/.expect/dtor-early-exit-ERR1.txt
===================================================================
--- src/tests/.expect/dtor-early-exit-ERR1.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/dtor-early-exit-ERR1.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: jump to label 'L1' crosses initialization of y Branch (Goto)
 
Index: src/tests/.expect/dtor-early-exit-ERR2.txt
===================================================================
--- src/tests/.expect/dtor-early-exit-ERR2.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/dtor-early-exit-ERR2.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: jump to label 'L2' crosses initialization of y Branch (Goto)
 
Index: src/tests/.expect/memberCtors-ERR1.txt
===================================================================
--- src/tests/.expect/memberCtors-ERR1.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/memberCtors-ERR1.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: in void ?{}(struct B *b), field a2 used before being constructed
 make: *** [memberCtors-ERR1] Error 1
Index: src/tests/.expect/scopeErrors.txt
===================================================================
--- src/tests/.expect/scopeErrors.txt	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/.expect/scopeErrors.txt	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -1,3 +1,2 @@
-CFA Version 1.0.0 (debug)
 Error: duplicate object definition for thisIsAnError: signed int
 Error: duplicate function definition for butThisIsAnError: function
Index: src/tests/Makefile.am
===================================================================
--- src/tests/Makefile.am	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/Makefile.am	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -15,6 +15,9 @@
 ###############################################################################
 
+debug=yes
+
 # applies to both programs
-CFLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ # TEMPORARY: does not build with -O2
+EXTRA_FLAGS =
+CFLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}
 CC = @CFA_BINDIR@/cfa
 
@@ -30,5 +33,5 @@
 
 all-tests :
-	@+python test.py --all		# '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
+	@+python test.py --all --debug=${debug}		# '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
 
 clean-local :
@@ -54,5 +57,5 @@
 
 declarationSpecifier: declarationSpecifier.c
-	${CC} ${CFALGS} -CFA -XCFA -p ${<} -o ${@}
+	${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
 
 gccExtensions : gccExtensions.c
@@ -63,4 +66,3 @@
 
 memberCtors-ERR1: memberCtors.c
-	${CC} ${CFALGS} -DERR1 ${<} -o ${@}
-
+	${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
Index: src/tests/Makefile.in
===================================================================
--- src/tests/Makefile.in	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/Makefile.in	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -123,7 +123,5 @@
 CFA_LIBDIR = @CFA_LIBDIR@
 CFA_PREFIX = @CFA_PREFIX@
-
-# applies to both programs
-CFLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ # TEMPORARY: does not build with -O2
+CFLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -223,4 +221,8 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+debug = yes
+
+# applies to both programs
+EXTRA_FLAGS = 
 fstream_test_SOURCES = fstream_test.c
 vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
@@ -652,5 +654,5 @@
 
 all-tests :
-	@+python test.py --all		# '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
+	@+python test.py --all --debug=${debug}		# '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
 
 clean-local :
@@ -676,5 +678,5 @@
 
 declarationSpecifier: declarationSpecifier.c
-	${CC} ${CFALGS} -CFA -XCFA -p ${<} -o ${@}
+	${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
 
 gccExtensions : gccExtensions.c
@@ -685,5 +687,5 @@
 
 memberCtors-ERR1: memberCtors.c
-	${CC} ${CFALGS} -DERR1 ${<} -o ${@}
+	${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: src/tests/test.py
===================================================================
--- src/tests/test.py	(revision 375a068b3108942e02b2e4dce77e8cb4873fd692)
+++ src/tests/test.py	(revision 74e5a3aa6b9010315116a44eb4977d4f150313eb)
@@ -104,5 +104,5 @@
 #               running test functions
 ################################################################################
-def run_single_test(test, generate, dry_run):
+def run_single_test(test, generate, dry_run, debug):
 
 	# find the output file based on the test name and options flag
@@ -113,6 +113,8 @@
 	sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
 
+	options = "-debug" if debug else "-nodebug";
+
 	# build, skipping to next test on error
-	make_ret, _ = sh("%s %s 2> %s 1> /dev/null" % (make_cmd, test.name, out_file), dry_run)
+	make_ret, _ = sh("""%s EXTRA_FLAGS="-quiet %s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
 
 	# if the make command succeds continue otherwise skip to diff
@@ -165,10 +167,10 @@
 	return retcode, error
 
-def run_test_instance(t, generate, dry_run) :
+def run_test_instance(t, generate, dry_run, debug) :
 	# print formated name
 	name_txt = "%20s  " % t.name
 
 	#run the test instance and collect the result
-	test_failed, error = run_single_test(t, generate, dry_run)
+	test_failed, error = run_single_test(t, generate, dry_run, debug)
 
 	# update output based on current action
@@ -194,5 +196,5 @@
 
 # run the given list of tests with the given parameters
-def run_tests(tests, generate, dry_run, jobs) :
+def run_tests(tests, generate, dry_run, jobs, debug) :
 	# clean the sandbox from previous commands
 	sh("%s clean > /dev/null 2>&1" % make_cmd, dry_run)
@@ -207,5 +209,5 @@
 	pool = Pool(jobs)
 	try :
-		results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run), tests ).get(99999999)
+		results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests ).get(99999999)
 	except KeyboardInterrupt:
 		pool.terminate()
@@ -222,4 +224,13 @@
 	return 0
 
+def yes_no(string):
+	if string == "yes" :
+		return True
+	if string == "no" :
+		return False
+	raise argparse.ArgumentTypeError(msg)
+	return False
+
+
 ################################################################################
 #               main loop
@@ -227,4 +238,5 @@
 # create a parser with the arguments for the tests script
 parser = argparse.ArgumentParser(description='Script which runs cforall tests')
+parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no')
 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')
@@ -296,5 +308,5 @@
 	sys.exit(1)
 
-print('Running on %i cores' % options.jobs)
+print('Running (%s) on %i cores' % ("debug" if options.debug else "no debug", options.jobs))
 make_cmd = "make" if make_flags else ("make -j%i" % options.jobs)
 
@@ -305,3 +317,3 @@
 else :
 	# otherwise run all tests and make sure to return the correct error code
-	sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run, options.jobs) )
+	sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run, options.jobs, options.debug) )
