OCaml Forge
Feature Requests
Search the entire project
This project's trackers
This project's releases
This project's news
Project
People
Advanced search
Log In
New Account
Home
My Page
Projects
Code Snippets
OUnit
Summary
Activity
Tracker
Lists
News
SCM
Files
Detail: [#862] ounit: support timeouts and running tests in separate process
Feature Requests: Browse
|
Download .csv
|
Monitor
[#862] ounit: support timeouts and running tests in separate process
Date:
2011-01-04 13:08
Priority:
3
State:
Open
Submitted by:
Török Edwin (
edwin
)
Assigned to:
Sylvain Le Gall (gildor-admin)
Component:
General
Operating System:
All
Product:
ounit
Summary:
ounit: support timeouts and running tests in separate process
Detailed description
there should be a way in ounit to use timeouts.
I can sort of do that now with something like this (see below), but I guess it won't work on windows, and won't work if ounit ever learns to run the tests in parallel.
Also it doesn't work if the testcase throws a stack overflow, (or otherwise wants to segfault), setting a signal handler will just keep ocaml in an infinite loop.
So I think ounit should have a way to run tests in subprocesses, that way I can tell exactly which test failed, and timeouts would work better (killing process won't kill entire testsuite), and you can also easily run multiple tests in parallel if you decide to support that in the future.
Of course spawning a process is not a cheap task, so this should be configurable (optional param to run_test_tt_main?) and by default off.
open OUnit;;
let rec forever () = forever ();;
let test1 () =
Unix.alarm 2;
forever ();;
let suite =
"suite">:::["test1">:: test1];;
let _ =
Sys.signal 14 (Sys.Signal_handle (fun _ -> failwith "timeout"));
run_test_tt_main suite;
Followup
Message
Date: 2011-01-14 14:44
Sender:
Sylvain Le Gall
There are other possibilities:
- use thread and Thread.kill after a timeout
- use Lwt and Lwt.cancel
Need to think about it, this is not an easy feature request.
Attached Files:
Changes:
Field
Old Value
Date
By
assigned_to
none
2011-01-14 14:44
gildor-admin