Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromocaml/ocaml

Commit5839c98

Browse files
committed
Reorganize some of the Unix and Bigarray tests
tests/lib-unix contains Unix-only teststests/lib-bigarray contains Bigarray-only teststests/lib-bigarray-file contains test that need both Unix and BigarrayThe purpose is to avoid doing Unix.fork() in tests linked with bigarray.cma, because this currently causes failures in bytecode under Cygwin.
1 parent3627221 commit5839c98

File tree

6 files changed

+61
-40
lines changed

6 files changed

+61
-40
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#**************************************************************************
2+
#* *
3+
#* OCaml *
4+
#* *
5+
#* Xavier Clerc, SED, INRIA Rocquencourt *
6+
#* *
7+
#* Copyright 2010 Institut National de Recherche en Informatique et *
8+
#* en Automatique. *
9+
#* *
10+
#* All rights reserved. This file is distributed under the terms of *
11+
#* the GNU Lesser General Public License version 2.1, with the *
12+
#* special exception on linking described in the file LICENSE. *
13+
#* *
14+
#**************************************************************************
15+
16+
BASEDIR=../..
17+
LIBRARIES=unix bigarray
18+
ADD_COMPFLAGS=-I$(OTOPDIR)/otherlibs/$(UNIXLIBVAR)unix\
19+
-I$(OTOPDIR)/otherlibs/bigarray
20+
LD_PATH=$(TOPDIR)/otherlibs/$(UNIXLIBVAR)unix:$(TOPDIR)/otherlibs/bigarray
21+
22+
include$(BASEDIR)/makefiles/Makefile.several
23+
include$(BASEDIR)/makefiles/Makefile.common

‎testsuite/tests/lib-unix/test_unix.mlrenamed to ‎testsuite/tests/lib-bigarray-file/mapfile.ml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,6 @@ let test test_number answer correct_answer =
2626
(* Tests*)
2727

2828
lettests()=
29-
letdrainpipe=
30-
let max=2048in
31-
let buf=Buffer.create2048in
32-
let tmp=Bytes.create maxin
33-
whilebegin
34-
try
35-
let len=Unix.read pipe tmp0 maxin
36-
Buffer.add_subbytes buf tmp0 len;
37-
len>0
38-
withUnix.Unix_error (Unix.EPIPE,_,_)whenfalse ->
39-
false
40-
enddo()done;
41-
Buffer.contents buf
42-
in
43-
44-
letrunexeargs=
45-
let out_in, out_out=Unix.pipe()in
46-
let err_in, err_out=Unix.pipe()in
47-
let args=Array.append [| exe |] argsin
48-
let pid=Unix.create_process exe argsUnix.stdin out_out err_outin
49-
Unix.close out_out;
50-
Unix.close err_out;
51-
let output= drain out_inin
52-
let error= drain err_inin
53-
Unix.close out_in;
54-
Unix.close err_in;
55-
let _pid, status=Unix.waitpid[ ] pidin
56-
status, output, error
57-
in
58-
59-
testing_function"create_process";
60-
ignore (run"cp" [||]);
61-
test1()();
62-
6329
testing_function"map_file";
6430
let mapped_file=Filename.temp_file"bigarray"".data"in
6531
begin
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11

2-
create_process
3-
1...
42
map_file
53
1... 2... 3... 4...

‎testsuite/tests/lib-unix/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
#**************************************************************************
1515

1616
BASEDIR=../..
17-
LIBRARIES=unix bigarray
18-
ADD_COMPFLAGS=-I$(OTOPDIR)/otherlibs/$(UNIXLIBVAR)unix\
19-
-I$(OTOPDIR)/otherlibs/bigarray
20-
LD_PATH=$(TOPDIR)/otherlibs/$(UNIXLIBVAR)unix:$(TOPDIR)/otherlibs/bigarray
17+
LIBRARIES=unix
18+
ADD_COMPFLAGS=-I$(OTOPDIR)/otherlibs/$(UNIXLIBVAR)unix
19+
LD_PATH=$(TOPDIR)/otherlibs/$(UNIXLIBVAR)unix
2120

2221
ifeq ($(OS),Windows_NT)
2322
ADD_BYTERUN_FLAGS="-I$(OTOPDIR)/otherlibs/win32unix"

‎testsuite/tests/lib-unix/pipe_eof.ml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
letdrainpipe=
2+
let max=2048in
3+
let buf=Buffer.create2048in
4+
let tmp=Bytes.create maxin
5+
whilebegin
6+
try
7+
let len=Unix.read pipe tmp0 maxin
8+
Buffer.add_subbytes buf tmp0 len;
9+
len>0
10+
withUnix.Unix_error (Unix.EPIPE,_,_)whenfalse ->
11+
false
12+
enddo()done;
13+
Buffer.contents buf
14+
;;
15+
16+
letrunexeargs=
17+
let out_in, out_out=Unix.pipe()in
18+
let err_in, err_out=Unix.pipe()in
19+
let args=Array.append [| exe |] argsin
20+
let pid=Unix.create_process exe argsUnix.stdin out_out err_outin
21+
Unix.close out_out;
22+
Unix.close err_out;
23+
let output= drain out_inin
24+
let error= drain err_inin
25+
Unix.close out_in;
26+
Unix.close err_in;
27+
let _pid, status=Unix.waitpid[ ] pidin
28+
status, output, error
29+
;;
30+
31+
let _=
32+
ignore (run"cp" [||]);
33+
print_endline"success"
34+
;;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
success

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp