Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
1e35d95d
Commit
1e35d95d
authored
18 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
Add some message logging
parent
d8387b41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/ftp.pm
+15
-12
15 additions, 12 deletions
tests/ftp.pm
tests/ftpserver.pl
+1
-1
1 addition, 1 deletion
tests/ftpserver.pl
tests/runtests.pl
+42
-16
42 additions, 16 deletions
tests/runtests.pl
with
58 additions
and
29 deletions
tests/ftp.pm
+
15
−
12
View file @
1e35d95d
...
...
@@ -147,7 +147,7 @@ sub checkalivepidfile {
# how many times a pid is repeated it will only be signalled once.
#
sub
signalpids
{
my
(
$signal
,
$pids
)
=
@_
;
my
(
$signal
,
$pids
,
$verbose
)
=
@_
;
if
((
not
defined
$signal
)
||
(
not
defined
$pids
))
{
return
;
...
...
@@ -155,6 +155,7 @@ sub signalpids {
if
(
$pids
!~
/\s+/
)
{
# avoid sorting if only one pid
if
(
checkalivepid
(
$pids
)
>
0
)
{
printf
("
* pid
$pids
signalled (
$signal
)
\n
")
if
(
$verbose
);
kill
(
$signal
,
$pids
);
}
return
;
...
...
@@ -166,6 +167,7 @@ sub signalpids {
if
(
$prev
!=
$pid
)
{
$prev
=
$pid
;
if
(
checkalivepid
(
$pid
)
>
0
)
{
printf
("
* pid
$pid
signalled (
$signal
)
\n
")
if
(
$verbose
);
kill
(
$signal
,
$pid
);
}
}
...
...
@@ -180,11 +182,11 @@ sub signalpids {
# with that pid is actually alive.
#
sub
signalpidfile
{
my
(
$signal
,
$pidfile
)
=
@_
;
my
(
$signal
,
$pidfile
,
$verbose
)
=
@_
;
my
$pid
=
pidfromfile
(
$pidfile
);
if
(
$pid
>
0
)
{
signalpids
(
$signal
,
$pid
);
signalpids
(
$signal
,
$pid
,
$verbose
);
}
}
...
...
@@ -257,16 +259,16 @@ sub waitalivepidfile {
# any of them in DEFAULT_TIMEOUT_STOP seconds then it returns 0.
#
sub
stopprocess
{
my
(
$pids
)
=
@_
;
my
(
$pids
,
$verbose
)
=
@_
;
if
(
not
defined
$pids
)
{
return
1
;
}
signalpids
("
KILL
",
$pids
);
signalpids
("
KILL
",
$pids
,
$verbose
);
if
(
waitdeadpid
(
$pids
,
$ONE_HALF_STOP_TIMEOUT
)
==
0
)
{
signalpids
("
KILL
",
$pids
);
signalpids
("
KILL
",
$pids
,
$verbose
);
if
(
waitdeadpid
(
$pids
,
$ONE_THIRD_STOP_TIMEOUT
)
==
0
)
{
signalpids
("
KILL
",
$pids
);
signalpids
("
KILL
",
$pids
,
$verbose
);
if
(
waitdeadpid
(
$pids
,
$ONE_SIXTH_STOP_TIMEOUT
)
==
0
)
{
return
0
;
# at least one pid is still alive !!!
}
...
...
@@ -284,7 +286,7 @@ sub stopprocess {
# returns 0.
#
sub
stopprocesspidfile
{
my
(
$pidfile
)
=
@_
;
my
(
$pidfile
,
$verbose
)
=
@_
;
if
(
not
defined
$pidfile
)
{
return
1
;
...
...
@@ -292,7 +294,7 @@ sub stopprocesspidfile {
my
$ret
=
1
;
# assume success stopping it
my
$pid
=
checkalivepidfile
(
$pidfile
);
if
(
$pid
>
0
)
{
$ret
=
stopprocess
(
$pid
);
$ret
=
stopprocess
(
$pid
,
$verbose
);
}
unlinkpidfiles
(
$pidfile
);
return
$ret
;
...
...
@@ -306,7 +308,7 @@ sub stopprocesspidfile {
# to stop it in DEFAULT_TIMEOUT_STOP seconds then it returns 0.
#
sub
ftpkillslave
{
my
(
$id
,
$ext
)
=
@_
;
my
(
$id
,
$ext
,
$verbose
)
=
@_
;
if
(
not
defined
$id
)
{
$id
=
"";
...
...
@@ -326,7 +328,7 @@ sub ftpkillslave {
}
}
if
(
$pids
)
{
$ret
=
stopprocess
(
$pids
);
$ret
=
stopprocess
(
$pids
,
$verbose
);
}
if
(
$pidfiles
)
{
unlinkpidfiles
(
$pidfiles
);
...
...
@@ -342,6 +344,7 @@ sub ftpkillslave {
# of them in DEFAULT_TIMEOUT_STOP seconds then returns 0.
#
sub
ftpkillslaves
{
my
(
$verbose
)
=
@_
;
my
$ret
=
1
;
# assume success stopping them
my
$pids
=
"";
...
...
@@ -359,7 +362,7 @@ sub ftpkillslaves {
}
}
if
(
$pids
)
{
$ret
=
stopprocess
(
$pids
);
$ret
=
stopprocess
(
$pids
,
$verbose
);
}
if
(
$pidfiles
)
{
unlinkpidfiles
(
$pidfiles
);
...
...
This diff is collapsed.
Click to expand it.
tests/ftpserver.pl
+
1
−
1
View file @
1e35d95d
...
...
@@ -114,7 +114,7 @@ do {
sub
catch_zap
{
my
$signame
=
shift
;
print
STDERR
"
ftpserver.pl received SIG
$signame
, exiting
\n
";
ftpkillslave
s
();
ftpkillslave
(
$ftpdnum
,
$ext
,
1
);
die
"
Somebody sent me a SIG
$signame
";
}
$SIG
{
INT
}
=
\
&catch_zap
;
...
...
This diff is collapsed.
Click to expand it.
tests/runtests.pl
+
42
−
16
View file @
1e35d95d
...
...
@@ -440,6 +440,7 @@ sub stoptestserver {
my
$serverpids
=
"";
if
(
$run
{
$serv
})
{
logmsg
("
RUN: Stopping the
$serv
server...
\n
");
if
(
$run
{
$serv
}{'
slavepidfiles
'})
{
for
$pidfile
(
split
("
",
$run
{
$serv
}{'
slavepidfiles
'}))
{
$pidfiles
.=
"
$pidfile
";
...
...
@@ -450,29 +451,41 @@ sub stoptestserver {
}
delete
$run
{
$serv
}{'
slavepidfiles
'};
}
if
(
$run
{
$serv
}{'
pids
'})
{
$pid
=
$run
{
$serv
}{'
pids
'};
$serverpids
.=
"
$pid
";
delete
$run
{
$serv
}{'
pids
'};
}
if
(
$run
{
$serv
}{'
pidfile
'})
{
$pidfile
=
$run
{
$serv
}{'
pidfile
'};
$pidfiles
.=
"
$pidfile
";
$pid
=
checkalivepidfile
(
$pidfile
);
if
(
$pid
>
0
)
{
if
(
(
$pid
>
0
)
&&
(
$serverpids
!~
/\b$pid\b/
))
{
$serverpids
.=
"
$pid
";
}
delete
$run
{
$serv
}{'
pidfile
'};
}
if
(
$run
{
$serv
}{'
pids
'})
{
$pid
=
$run
{
$serv
}{'
pids
'};
$serverpids
.=
"
$pid
";
delete
$run
{
$serv
}{'
pids
'};
}
if
(
$run
{
$serv
})
{
delete
$run
{
$serv
};
}
}
if
(
$slavepids
)
{
$ret
=
stopprocess
(
$slavepids
);
logmsg
("
* slave pid(s)
$slavepids
\n
");
}
if
(
$serverpids
)
{
logmsg
("
* server pid(s)
$serverpids
\n
");
}
if
(
$slavepids
)
{
$ret
=
stopprocess
(
$slavepids
,
1
);
if
(
$ret
==
0
)
{
logmsg
("
* slave process is still alive !!!
\n
");
}
}
if
(
$serverpids
)
{
$ret
=
stopprocess
(
$serverpids
);
$ret
=
stopprocess
(
$serverpids
,
1
);
if
(
$ret
==
0
)
{
logmsg
("
* server process is still alive !!!
\n
");
}
}
if
(
$pidfiles
)
{
unlinkpidfiles
(
$pidfiles
);
...
...
@@ -1849,6 +1862,7 @@ sub stopalltestservers {
for
my
$serv
(
keys
%run
)
{
if
(
$run
{
$serv
})
{
logmsg
("
RUN: Stopping the
$serv
server...
\n
");
if
(
$run
{
$serv
}{'
slavepidfiles
'})
{
for
$pidfile
(
split
("
",
$run
{
$serv
}{'
slavepidfiles
'}))
{
$pidfiles
.=
"
$pidfile
";
...
...
@@ -1859,30 +1873,42 @@ sub stopalltestservers {
}
delete
$run
{
$serv
}{'
slavepidfiles
'};
}
if
(
$run
{
$serv
}{'
pids
'})
{
$pid
=
$run
{
$serv
}{'
pids
'};
$serverpids
.=
"
$pid
";
delete
$run
{
$serv
}{'
pids
'};
}
if
(
$run
{
$serv
}{'
pidfile
'})
{
$pidfile
=
$run
{
$serv
}{'
pidfile
'};
$pidfiles
.=
"
$pidfile
";
$pid
=
checkalivepidfile
(
$pidfile
);
if
(
$pid
>
0
)
{
if
(
(
$pid
>
0
)
&&
(
$serverpids
!~
/\b$pid\b/
))
{
$serverpids
.=
"
$pid
";
}
delete
$run
{
$serv
}{'
pidfile
'};
}
if
(
$run
{
$serv
}{'
pids
'})
{
$pid
=
$run
{
$serv
}{'
pids
'};
$serverpids
.=
"
$pid
";
delete
$run
{
$serv
}{'
pids
'};
}
if
(
$run
{
$serv
})
{
delete
$run
{
$serv
};
}
}
}
if
(
$slavepids
)
{
$ret
=
stopprocess
(
$slavepids
);
logmsg
("
* slave pid(s)
$slavepids
\n
");
}
if
(
$serverpids
)
{
logmsg
("
* server pid(s)
$serverpids
\n
");
}
if
(
$slavepids
)
{
$ret
=
stopprocess
(
$slavepids
,
1
);
if
(
$ret
==
0
)
{
logmsg
("
* slave process is still alive !!!
\n
");
}
}
if
(
$serverpids
)
{
$ret
=
stopprocess
(
$serverpids
);
$ret
=
stopprocess
(
$serverpids
,
1
);
if
(
$ret
==
0
)
{
logmsg
("
* server process is still alive !!!
\n
");
}
}
if
(
$pidfiles
)
{
unlinkpidfiles
(
$pidfiles
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment