Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 9e72dbb75640618596acfcb92156edb505a935dc)
+++ tests/Makefile.am	(revision ef22ad65ff9727de264304f61406d2505d5d7d45)
@@ -22,4 +22,5 @@
 debug=yes
 installed=no
+archiveerrors=
 
 INSTALL_FLAGS=-in-tree
@@ -56,8 +57,8 @@
 #----------------------------------------------------------------------------------------------------------------
 all-local :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} ${quick_test}
+	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
 
 all-tests :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
+	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
 
 clean-local :
Index: tests/Makefile.in
===================================================================
--- tests/Makefile.in	(revision 9e72dbb75640618596acfcb92156edb505a935dc)
+++ tests/Makefile.in	(revision ef22ad65ff9727de264304f61406d2505d5d7d45)
@@ -377,4 +377,5 @@
 debug = yes
 installed = no
+archiveerrors = 
 INSTALL_FLAGS = -in-tree
 DEBUG_FLAGS = -debug -O0
@@ -770,8 +771,8 @@
 #----------------------------------------------------------------------------------------------------------------
 all-local :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} ${quick_test}
+	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
 
 all-tests :
-	@+${TEST_PY} --debug=${debug}  --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
+	@+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
 
 clean-local :
Index: tests/pybin/settings.py
===================================================================
--- tests/pybin/settings.py	(revision 9e72dbb75640618596acfcb92156edb505a935dc)
+++ tests/pybin/settings.py	(revision ef22ad65ff9727de264304f61406d2505d5d7d45)
@@ -4,5 +4,8 @@
 from . import tools
 
+global original_path
+
 try :
+	original_path = os.getcwd()
 	testpath = os.path.dirname(os.path.abspath(os.path.join(os.getcwd(), sys.argv[0])))
 	sys.path.append(testpath)
@@ -113,4 +116,5 @@
 	global timeout
 	global output_width
+	global archive
 
 	dry_run      = options.dry_run
@@ -122,4 +126,5 @@
 	timeout      = Timeouts(options.timeout, options.global_timeout)
 	output_width = 24
+	archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
 
 
Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision 9e72dbb75640618596acfcb92156edb505a935dc)
+++ tests/pybin/tools.py	(revision ef22ad65ff9727de264304f61406d2505d5d7d45)
@@ -2,4 +2,5 @@
 import argparse
 import contextlib
+import datetime
 import fileinput
 import multiprocessing
@@ -273,4 +274,9 @@
 ################################################################################
 
+def pretty_now():
+	ts = time.time()
+	print(ts, file=sys.stderr)
+	return datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H:%M:%S')
+
 # check if arguments is yes or no
 def yes_no(string):
@@ -304,4 +310,21 @@
 	return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output=subprocess.PIPE)
 
+def core_archive(dst, name, exe):
+	# Get the files to copy
+	core = os.path.join(os.getcwd(), "core" )
+
+	# Uncomment if we want timestamps on coredumps
+	# dst  = os.path.join(dst, "%s_%s" % (name, pretty_now()))
+
+	# make a directory for this test
+	mkdir(os.path.join(dst, "dir"))
+
+	# moves the files
+	mv( core, os.path.join(dst, "core" ) )
+	mv( exe , os.path.join(dst, name   ) )
+
+	# return explanatory test
+	return "Archiving %s (executable and core) to %s" % (os.path.relpath(exe, settings.BUILDDIR), os.path.relpath(dst, settings.original_path))
+
 class Timed:
     def __enter__(self):
Index: tests/test.py
===================================================================
--- tests/test.py	(revision 9e72dbb75640618596acfcb92156edb505a935dc)
+++ tests/test.py	(revision ef22ad65ff9727de264304f61406d2505d5d7d45)
@@ -91,4 +91,5 @@
 	parser.add_argument('--all', help='Run all test available', 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('--archive-errors', help='If called with a valid path, on test crashes the test script will copy the core dump and the executable to the specified path.', type=str, default='')
 	parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int)
 	parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
@@ -179,4 +180,7 @@
 			error = error + info if error else info
 
+			if settings.archive:
+				error = error + '\n' + core_archive(settings.archive, test.target(), exe_file)
+
 
 
@@ -295,5 +299,5 @@
 	# users may want to simply list the tests
 	if options.list_comp :
-		print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --install --timeout --global-timeout -j --jobs ", end='')
+		print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout -j --jobs ", end='')
 		print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
 
