Commit graph

899 commits

Author SHA1 Message Date
Paul Stansifer
86f337484e Change macro syntax to accept a single expr, not a sequence of exprs. 2011-07-28 12:12:08 -07:00
Eric Holk
5302cde188 Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -07:00
Eric Holk
e697a52359 Adding a function to stdlib to set the min stack size, for programs
that absolutely will not succeed with a large default stack. This
should be removed once we have stack grown working.

Also updated word-count to succeed under the new test framework.
2011-07-28 10:47:28 -07:00
Eric Holk
117e251733 Re-removing a test case that was moved during the big test suite overhaul. 2011-07-28 10:47:28 -07:00
Eric Holk
62bc6b5113 Per-thread scheduling. Closes #682.
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
2011-07-28 10:47:28 -07:00
Lindsey Kuper
c15871ac51 Test case for issue #435. 2011-07-28 10:37:46 -07:00
Graydon Hoare
acac6abc85 Parse, store and print type parameter kind constraints. 2011-07-28 17:22:59 +00:00
Marijn Haverbeke
1836f59d9a Disable expr-scope test, since it break windows 2011-07-28 12:02:08 +02:00
Josh Matthews
f0e29c92aa :: is allowed to start an expression. Close #762. 2011-07-28 02:33:24 -04:00
Brian Anderson
e81d6d28e7 Don't stop at first test failure
Since compiletest is setting up its own test tasks it needs to configure them
the correct way, which means allowing them to leak.
2011-07-27 19:04:57 -07:00
Brian Anderson
51ef7a3676 Clean up output a bit when running verbose compile tests 2011-07-27 19:04:56 -07:00
Brian Anderson
e9dd971129 Capture stderr when running compile tests. Closes #755 2011-07-27 19:04:56 -07:00
Brian Anderson
278d360525 Refactor compiletest 2011-07-27 19:04:56 -07:00
Michael Sullivan
d1298f768c Have bind support non-alias parametric non-bound arguments.
This was previously disallowed by the typechecker and not properly handled
in trans. I removed the typechecker check (replacing it with a simpler
check that spawned functions don't have type params) and fixed trans.
Closes #756.
2011-07-27 18:46:46 -07:00
Michael Sullivan
4de0b3d947 Allow already bound functions to be bound again.
This commit just disables the check. All of the real work was in previous
commits that moved the target function into the bindings part of the closure
that is tracked by the tydesc.
Closes #754.
2011-07-27 18:46:46 -07:00
Michael Sullivan
04611a3e56 Remove the bind-alias test, since binding to aliases is fine. 2011-07-27 16:14:57 -07:00
Brian Anderson
80d6ee9ae7 Remove task::worker harder 2011-07-27 16:07:31 -07:00
Brian Anderson
92e9382193 Remove task::worker
It was too unsafe to live. It already apeared to be causing problems with
eholk's incoming task changes, so I'm killing it now before it can spread.
2011-07-27 15:53:47 -07:00
Brian Anderson
0923d67096 Fix comment placement in compiletest 2011-07-27 11:17:03 -07:00
Marijn Haverbeke
edd1a0230e Fix nil pattern case to handle for parser adjustment 2011-07-27 16:55:49 +02:00
Marijn Haverbeke
6e2a7bff7f Fix damage done by the pretty-printer 2011-07-27 15:54:33 +02:00
Marijn Haverbeke
df7f21db09 Reformat for new syntax 2011-07-27 15:54:33 +02:00
Brian Anderson
bcb5c4d54f Run compile tests in a way that's safe in a multithreaded environment
In theory. There's still something leaking but I hope it's no longer due to
the test runner doing unsafe things.

This is a pretty nasty patch, working around limitations in the type and task
systems, and it makes the std::test API a little uglier.
2011-07-26 18:39:55 -07:00
Brian Anderson
1c780b4203 Make the setenv tests threadsafe(ish) 2011-07-26 17:47:36 -07:00
Brian Anderson
d52169686b Dump all subprocess output to stdout when running verbose compiler tests 2011-07-26 15:36:58 -07:00
Michael Sullivan
4c17cb73a2 Add a bunch of tests for blocks. 2011-07-26 12:34:38 -07:00
Brian Anderson
e37dd2646a Clone all data before before putting it in a test closure
Putting shared boxes into a closure then running that closure in parallel
tasks seems like a recipe for refcounting disaster.

This doesn't completely fix the problems when running in parallel, but I'm
working on it.
2011-07-26 11:12:20 -07:00
Brian Anderson
f110c20609 Join the process server after running all compile tests 2011-07-26 11:12:20 -07:00
Brian Anderson
067cb6d537 Run test process from a dedicated task
This avoids a race wherein test tasks could run processes that stole the
environment of other tasks's processes.
2011-07-26 11:12:20 -07:00
Paul Stansifer
d11c887382 Add basic support for blocks and types in macros. 2011-07-26 11:09:37 -07:00
Marijn Haverbeke
2509a3dcae Resolve loop collection expressions in the right scope
Closes #745
2011-07-26 15:52:59 +02:00
Marijn Haverbeke
bc9db454a0 Fixup test changes 2011-07-26 14:56:24 +02:00
Marijn Haverbeke
c0976ad70b Properly parse 'auto' for loop variable types 2011-07-26 14:53:01 +02:00
Marijn Haverbeke
f8968d1e71 Remove uses of tuples from the test suite 2011-07-26 14:49:40 +02:00
Brian Anderson
ac2424dd22 Run test tasks in parallel according to RUST_THREADS. Issue #734 2011-07-25 16:36:38 -07:00
Brian Anderson
2de43c220c Disable task-comm-15. Fails with multiple threads. 2011-07-25 16:34:49 -07:00
Brian Anderson
758c11b22c Ignore various files that are probably not tests when searching for tests
Closes #732
2011-07-25 12:20:23 -07:00
Marijn Haverbeke
beab6ba8aa Add a pass that checks for unreachable alt arms 2011-07-25 13:52:59 +02:00
Brian Anderson
bd81adabff Add task::send and task::recv 2011-07-24 16:18:31 -07:00
Brian Anderson
73fed01108 Add task::worker. Spawns a task and returns a channel to it
It takes a lot of boilerplate to create a task and establish a way to talk to
it. This function simplifies that, allowing you to write something like
'worker(f).chan <| start'. Implementation is very unsafe and only works for a
few types of channels, but something like this is very useful.
2011-07-24 16:18:05 -07:00
Brian Anderson
b82bedb28e Reindent lib-task.rs 2011-07-24 16:17:25 -07:00
Brian Anderson
2573fe7026 The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.

A few main things happen here:

1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.

2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.

3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.

4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.

It adds two new features to the cfail/rfail/rpass/bench tests:

1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.

2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.

There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.

Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.

This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-24 15:34:34 -07:00
Eric Holk
63e77a3de1 Attempt to put out burning Windows tinderbox. 2011-07-23 13:01:30 -07:00
Eric Holk
8878b128ba More work on word-count.
Updated the MapReduce protocol so that it's correct more often. It's
still not perfect, but the bugs repro less often now.

Also found a race condition in channel sending. The problem is that
send and receive both need to refer to the _unread field in
circular_buffer. For now I just grabbed the port lock to send. We can
probably get around this by using atomics instead.
2011-07-22 18:45:34 -07:00
Eric Holk
404d4e0528 Adding test case dealing with communication and hashmaps. 2011-07-22 18:45:34 -07:00
Eric Holk
c7e967148c Task-ified the word count program.
This meant most of the generic-ness of it had to go away, since our
type system doesn't quite support it yet. Hopefully someday...

This version has lots of memory management errors. My next commit will
hopefully fix these.
2011-07-22 18:45:34 -07:00
Paul Stansifer
e18d70fe12 Implement Macro By Example. 2011-07-22 16:53:43 -07:00
Eric Holk
4a6ccf3b0f Adding test case for #687.
The test no longer repros after a lot of my recent channel work.

Closes #687.
2011-07-22 16:22:20 -07:00
Eric Holk
54be5b044f Fixing (or at least improving) translation of move semantics for send and receive. This let's us run all of the task-comm tests. 2011-07-22 16:05:51 -07:00
Lindsey Kuper
e71f261e3f Exercise self-calls and overriding together a bit more. 2011-07-22 13:29:46 -07:00
Lindsey Kuper
fefeebce24 Getting rid of obsolete comments. 2011-07-22 13:10:44 -07:00
Eric Holk
898083f8fc Commenting out the huge-memory-using lines in pfib. 2011-07-22 11:55:07 -07:00
Brian Anderson
07732545d2 Add xfail-stage3 directives to tests
The new test runners run stage 3
2011-07-22 10:18:28 -07:00
Marijn Haverbeke
bc33897525 Revert "Enable run-pass/lib-run on win32. Closes #714"
This reverts commit 1348a383c3.

Seems that this test is still broken on win.
2011-07-22 09:59:27 +02:00
Marijn Haverbeke
93ffed4c16 Fix unboxing in alias pass
The alias checker would only deref once for autoderef, and only deref
boxes. It should now do the right thing. Closes #725.
2011-07-22 09:29:01 +02:00
Brian Anderson
1348a383c3 Enable run-pass/lib-run on win32. Closes #714 2011-07-21 19:52:27 -07:00
Brian Anderson
ed25dfe2ca Disable run-pass/lib-io.rs on mac 2011-07-21 19:36:55 -07:00
Brian Anderson
06a6005447 Use correct win file open constants, per MinGW 2011-07-21 18:23:15 -07:00
Tim Chevalier
a9a1392b2c Instantiate function preconditions inside the function body
so that if we have a function like:
f(...) : p(x) {
  ...
}

p(x) is true inside the body of f.

Closes #694.
2011-07-21 16:11:34 -07:00
Lindsey Kuper
451e438ed0 Un-xfail tests. 2011-07-21 15:28:00 -07:00
Eric Holk
d79afd7916 Improving move semantics for channel operations.
This lets us un-XFAIL task-comm-10.rs.
2011-07-21 11:51:22 -07:00
Eric Holk
3ae4dcd41e Lots of work on memory tracking and channels.
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.

Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Tim Chevalier
8a7f2e0fe5 Parse nil literals (including in patterns)
Closes #622.
2011-07-20 16:02:53 -07:00
Lindsey Kuper
431cb9a345 Test method overriding a little more. 2011-07-20 15:49:33 -07:00
Lindsey Kuper
336949a590 Test case for issue #718. 2011-07-20 15:47:29 -07:00
Lindsey Kuper
7a919da04e Method overriding tests suddenly pass valgrind for some reason.
I'm not sure if this is because of changes to glue generation in the
last few days while I've been working on other things, or if it's a
side effect of the improvements I made to typechecking for anonymous
objects, or something else, but I guess I'll take it!

Closes issue #543.
2011-07-20 12:49:54 -07:00
Lindsey Kuper
94f2a7b9a7 'Overriding' is a more accurate name than 'overloading' for these. 2011-07-20 12:22:55 -07:00
Lindsey Kuper
2eb4762936 Typechecking self-calls in anon objs. Closes #540. 2011-07-19 19:52:21 -07:00
Tim Chevalier
bd4aeef78b Beginnings of support for constrained types
Programs with constrained types now parse and typecheck, but
typestate doesn't check them specially, so the one relevant test
case so far is XFAILed.

Also rewrote all of the constraint-related data structures in the
process (again), for some reason. I got rid of a superfluous
data structure in the context that was mapping front-end constraints
to resolved constraints, instead handling constraints in the same
way in which everything else gets resolved.
2011-07-19 18:57:28 -07:00
Brian Anderson
652214d7f9 Fix calculation of sizeof boxed ivec of str in rt. Closes #712 2011-07-19 16:55:45 -07:00
Brian Anderson
00e017f60e Disable run-pass/lib-run on win32. Issue #714
Trying to get the tinderbox green again. Will pursue later.
2011-07-19 15:55:15 -07:00
Lindsey Kuper
18162d3261 Some progress on issue #540. 2011-07-19 14:30:53 -07:00
Lindsey Kuper
a33bc56e43 Reduced test case for issue #540. 2011-07-19 12:48:06 -07:00
Erick Tryzelaar
b82c9c9e79 xfail simple-qsort.rs test at stage0. 2011-07-19 11:39:04 -07:00
Brian Anderson
fb9a117743 Fix an invalid memory access in run_program and friends 2011-07-19 10:15:16 -07:00
Brian Anderson
7e55061def Add str::replace 2011-07-18 16:16:48 -07:00
Brian Anderson
689f5f487c Add str::is_empty, is_not_empty preds 2011-07-18 16:16:48 -07:00
Lindsey Kuper
b6fc86ae5a Sane error message for self-call in non-obj context. Closes #707. 2011-07-18 15:58:36 -07:00
Michael Sullivan
71909a64bc Fix qsort to not skip the right side when the pivot element gets put at index 0.
Closes #705.
2011-07-18 15:03:31 -07:00
Brian Anderson
ad1c0e6308 Reformulate x86stdcall test so it works with check-fast
Hopefully this puts out the burning win32 tinderbox
2011-07-18 14:59:44 -07:00
Brian Anderson
b78eee8732 Fix native-type-mismatch test on win32 2011-07-18 13:56:19 -07:00
Brian Anderson
cc7ae32ba1 Add setenv to standard library 2011-07-18 13:56:19 -07:00
Brian Anderson
c40d6265ce Support x86 stdcall convention
This allows rust to call the Win32 API
2011-07-18 13:56:15 -07:00
Brian Anderson
20a3adbc08 Revert "Add setenv to standard library"
This reverts commit 6fb168b3db.
2011-07-17 19:16:18 -07:00
Brian Anderson
6fb168b3db Add setenv to standard library 2011-07-17 18:50:01 -07:00
Brian Anderson
4b7884e1fa Removing error logging from test 2011-07-16 19:56:12 -07:00
Brian Anderson
64d43be647 Sort tests before running them. Issue #428 2011-07-16 17:58:32 -07:00
Brian Anderson
8c4f1652ec Add ivec::zip/unzip 2011-07-16 17:36:11 -07:00
Brian Anderson
a52c3e0444 Remove unused variable from test tests 2011-07-16 16:48:33 -07:00
Lindsey Kuper
69abf0a5ff Revised plan of attack for backwarding functions. 2011-07-15 17:23:20 -07:00
Lindsey Kuper
c4265209a6 More tests for anonymous objects. Issues #702, #703. 2011-07-15 15:33:40 -07:00
Brian Anderson
ced8393f20 Modify task::join to indicate how the task terminated
This involves sticking yet another field into the task structure
2011-07-15 10:07:29 -07:00
Brian Anderson
ed6f9bb677 Add tests for unsupervise 2011-07-14 18:50:22 -07:00
Brian Anderson
20e94de392 Add a flag to run ignored tests. Issue #428 2011-07-14 17:13:12 -07:00
Brian Anderson
81acf69f97 Add head and tail functions to std::ivec
They even have typestate preconditions
2011-07-14 17:13:12 -07:00
Brian Anderson
139aaa1616 Add is_empty, is_not_empty preds to std::ivec 2011-07-14 17:13:12 -07:00
Brian Anderson
b3dee95514 Add a facility for ignoring tests. Issue #428
Adding the #[ignore] attribute will cause the test not to be run, though it
will still show up in the list of tests.
2011-07-14 13:51:30 -07:00
Brian Anderson
f4beac4a43 Revert "Allow main to return int"
This reverts commit 8c94d8fd54.

There's no mechanism to actually return the value from main, so all this does
is allow main -> int to compile. Per #688, the program returns non-zero on
failure, so it's not obvious that this change is appropriate at this time.
2011-07-14 10:37:28 -07:00
Brian Anderson
fc67dddb9b XFAIL some tests in stage 0 2011-07-14 10:27:02 -07:00
Brian Anderson
8c94d8fd54 Allow main to return int 2011-07-13 19:22:53 -07:00