shithub: mc

Download patch

ref: 1b5b7ee4b7a10b39835369ac12462ef2231b6f2b
parent: bfeac2fcc8ec3ae417a2ad54b2b40d6a4b4b2754
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Sep 17 20:36:24 EDT 2015

Make tests run faster.

    Reduce iterations a bit so we can run them more often.

--- a/lib/thread/test/atomic.myr
+++ b/lib/thread/test/atomic.myr
@@ -15,13 +15,13 @@
 	while thread.xget(&done) != Nherd
 		/* nothing */
 	;;
-	std.assert(val == 20_000_000, "atomics are broken\n")
+	std.assert(val == 2_000_000, "atomics are broken\n")
 }
 
 const incvar = {
 	var i
 
-	for i = 0; i < 1_000_000; i++
+	for i = 0; i < 100_000; i++
 		thread.xadd(&val, 1)
 	;;
 	std.write(1, "done\n")
--- a/lib/thread/test/mutex.myr
+++ b/lib/thread/test/mutex.myr
@@ -18,13 +18,13 @@
 	while thread.xget(&done) != Nherd
 		/* nothing */
 	;;
-	if val != 100_000 * 20
+	if val != 10_000 * 20
 		std.fatal("mutexes are broken, got {}\n", val)
 	;;
 }
 
 const incvar = {
-	for var i = 0; i < 100_000; i++
+	for var i = 0; i < 10_000; i++
 		thread.mtxlock(&mtx)
 		val++
 		thread.mtxunlock(&mtx)