pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:1:
-
test_true([["$Id: testsuite.in,v 1.
712
2004/04/16
15
:
44
:
30
nilsson
Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
713
2004/04/16
16
:
46
:
08
grubba
Exp $"]]);
// This triggered a bug only if run sufficiently early. test_compile_any([[#pike 7.2]]) test_compile_any([[#pike 7.4]]) test_compile_any([[#pike 7.0]]) test_compile_any([[#pike 0.6]]) cond([[all_constants()->_verify_internals]], [[ test_do(_verify_internals())
pike.git/src/testsuite.in:10124:
test_any([[string s="foo"; s[2]='t'; s[0]--; return s;]],"eot") test_any([[string s="foo"; s[2]=0777; s[1]--; return s;]],"fn\777") test_any([[string s="foo"; s[2]=07777777; s[1]--; return s;]],"fn\7777777") test_any([[string s="foo"; s[2]='t'; catch (s[10]='x'); return s;]], "fot") cond([[all_constants()->_verify_internals]], [[ test_do(_verify_internals()) ]])
-
test_
program
([[
-
int
ok
=
1
;
-
-
void
test
_
resolv
(
string
file,
int
base
_
size
,
object|void
handler
)
-
{
+
test_
tests
([[
+
Stdio.File p
=
Stdio.File()
;
+
object pid = Process.create
_
process
(
RUNPIKE_ARRAY
+
+
({ "]]SRCDIR[[/test
_
resolve.pike" })
,
+
([ "stdout":p->pipe(Stdio.PROP_IPC
)
]));
__signal_watchdog();
-
string
prg
=
replace( file[base
_
size+1..sizeof
(
file)
-
6],
-
(
[ "/":".", ".pmod":""]
)
);
-
if
(
prg[sizeof(prg
)
-7..]==".module")
-
prg
=
prg[..sizeof
(
prg
)
-8]
;
-
//
werror("Resolving %O...\n", prg)
;
-
mixed
err
;
-
if
(err
= catch
(
(
handler||master
(
))->resolv(prg)
) )
{
-
werror
("
test
: failed
to
peek
at
%O:
%s\n",
-
prg,
describe_error
(err
));
-
ok=0
;
+
string
results
=
lower
_
case
(
p
-
>read
());
+
__signal_watchdog
()
;
+
int
err
=
pid->wait
();
+
int
ok
;
+
int
failed
;
+
if ((
sscanf
(
s,
"%*sok:%d", ok
)
!= 2
)
+
+
(
sscanf(s,
"
%*sfailed
:
%d",
failed
)
!=
2))
{
+
//
No
"ok",
and
no
"failed".
+
return
(
{
err
,
s
})
;
}
-
}
-
-
void
test_dir(string
dir, int|void base_size, object|void handler)
-
{
-
if (!Stdio.is_dir (dir))
return
;
-
// werror
(
"Testing directory %O...\n", dir);
-
if(!base_size) base_size=sizeof(dir);
-
array(string) files = get_dir(dir);
-
// Ensure that .so files are loaded before .pike and .pmod files.
-
// Otherwise their loading errors will be hidden.
-
sort(reverse(files[*]), files);
-
files = reverse(files);
-
foreach(files, string s)
-
{
-
switch(s)
-
{
-
#if !constant(GTK.Window)
-
case "GTKSupport.pmod":
-
case "PV.pike":
-
case "pv.pike":
-
#endif
-
continue; // These modules cannot be tested properly by this test
-
}
-
string file=combine_path(dir,s);
-
mixed stat=file_stat(file);
-
if(!stat) continue;
-
if(stat[1]==-2 && has_suffix(file, ".pmod"))
-
{
-
test_resolv(file, base_size, handler);
-
test_dir(file, base_size, handler);
-
}
-
else if(stat[1]>=0){
-
// DEBUG
-
if (lower_case(uname()->sysname||"") == "osf1") {
-
werror("Testing file %O...\n", file);
-
}
-
if(has_suffix(file, ".pike") || has_suffix(file, ".pmod") ||
-
has_suffix(file, ".so"))
-
{
-
#if 0
-
mixed err=catch { (program)file; };
-
if (err)
-
{
-
werror("test: failed to compile %O\n",file);
-
ok
=0;
-
continue;
-
}
-
#endif
-
if (has_suffix(file
,
".so")) {
-
if (!master()->programs[file]) {
-
// Clear any negative cache entry.
-
m_delete(master()->programs, file);
-
}
-
#if constant(load_module)
-
// Load .so files by hand to make sure
-
// loading errors aren't hidden.
-
mixed err;
-
if (err = catch{
-
program ret = load_module(file);
-
master()->programs[file] = ret;
-
}) {
-
werror("test:
failed
to load %O: %s\n",
-
file, describe_error(err));
-
ok=0;
-
}
else
-
#endif /* constant(load_module
)
*/
-
{
-
// "XX" pads suffix to 4 characters.
-
test_resolv(file+"XX", base_size, handler)
;
-
}
-
} else {
-
test_resolv(file, base_size, handler);
-
}
-
}
-
}
-
}
-
}
-
int a()
-
{
-
Array.map(master()->pike_module_path,test_dir);
-
// FIXME: Forward compatibility?
-
foreach(({"0.6","7.0","7.2","7.4"}),string ver) {
-
object handler = master()->get_compilation_handler(@(array(int))(ver/"."));
-
Array.map(handler->pike_module_path,test_dir,0,handler);
-
}
-
return ok;
-
}
+
return ({ ok, failed });
]]) // - modifiers, compile time type checks test_compile_any(class A {int v;} class B {inherit A; int v;}) test_compile_error_any(class A {int v;} class B {inherit A; float v;}) dnl test_compile_error_any(class A {int v;} class B {inherit A; mixed v;}) dnl test_compile_error_any(class A {mixed v;} class B {inherit A; int v;}) dnl test_compile_error_any(class A {public int v;} class B {inherit A; mixed v;}) dnl test_compile_error_any(class A { public { int v; } } class B {inherit A; mixed v;})