Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
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
Harbor 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
dCache
cta
Commits
14804a9c
Commit
14804a9c
authored
11 years ago
by
itglp
Browse files
Options
Downloads
Patches
Plain Diff
Removed obsoleted tests
parent
9a02dced
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/dlf/Imakefile
+0
-25
0 additions, 25 deletions
test/dlf/Imakefile
test/dlf/dlftest.c
+0
-358
0 additions, 358 deletions
test/dlf/dlftest.c
test/dlf/prepare.py
+0
-123
0 additions, 123 deletions
test/dlf/prepare.py
with
0 additions
and
506 deletions
test/dlf/Imakefile
deleted
100644 → 0
+
0
−
25
View file @
9a02dced
COMM -----------------------------------------------------------------------------------------------------#
COMM #
COMM Imakefile - Castor Distribution Logging Facility #
COMM Copyright (C) 2006 CERN IT/FIO (castor-dev@cern.ch) #
COMM #
COMM This program is free software; you can redistribute it and/or modify it under the terms of the GNU #
COMM General Public License as published by the Free Software Foundation; either version 2 of the #
COMM License, or (at your option) any later version. #
COMM #
COMM This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without #
COMM even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
COMM General Public License for more details. #
COMM #
COMM You should have received a copy of the GNU General Public License along with this program; if not, #
COMM write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, #
COMM USA. #
COMM #
COMM -----------------------------------------------------------------------------------------------------#
CPPFLAGS += -I$(CASTOR_ROOT)/dlf
DependsOnLibrary(common,castorcommon)
DependsOnLibrary(dlf,castordlf)
NormalProgramTarget(dlftest,dlftest.o,,,755)
This diff is collapsed.
Click to expand it.
test/dlf/dlftest.c
deleted
100644 → 0
+
0
−
358
View file @
9a02dced
/******************************************************************************************************
* *
* dlftest.c - Castor Distribution Logging Facility (Test Suite) *
* Copyright (C) 2006 CERN IT/FIO (castor-dev@cern.ch) *
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU *
* General Public License as published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without *
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with this program; if not, *
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, *
* USA. *
* *
******************************************************************************************************/
/* headers */
#include
<errno.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<sys/time.h>
#include
<time.h>
#include
<unistd.h>
#include
"Cglobals.h"
#include
"Cmutex.h"
#include
"Cthread_api.h"
#include
"Cuuid.h"
#include
"dlf_api.h"
#include
"serrno.h"
/* definitions */
#define DEFAULT_THREAD_COUNT 1
/**< number of threads to use to generate messages */
#define DEFAULT_MSG_TOTAL 1000
/**< the default total number of mesages to send */
/* mutexes
* - used to block multiple worker threads from violating the count of total messages
*/
int
test_mutex
;
/* global variables */
int
extensive
=
0
;
int
rate
=
1
;
int
total
=
0
;
int
count
=
0
;
/*
* Generate string
*/
void
genstring
(
char
*
str
,
int
len
)
{
/* variables */
int
i
=
0
;
char
c
=
0
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
do
{
c
=
(
char
)((
float
)
rand
()
/
(
float
)
RAND_MAX
*
(
float
)
256
);
}
while
(
!
((
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'A'
&&
c
<=
'Z'
)
||
(
c
>=
'0'
&&
c
<=
'9'
)));
str
[
i
]
=
c
;
}
str
[
i
]
=
'\0'
;
return
;
}
/*
* Worker
*/
void
worker
(
void
)
{
/* variables */
time_t
now
=
time
(
NULL
);
int
throughput
=
0
;
int
generated
=
0
;
/* message variables */
struct
Cns_fileid
nsfileid
=
{
"cns.cern.ch"
,
0
};
Cuuid_t
req_id
;
Cuuid_t
subreq_id
;
int
severity
;
int
msg_no
;
int
tpnum
;
int
rv
;
char
tpname
[
CA_MAXVIDLEN
+
20
];
int
pari
;
U_HYPER
pari64
;
float
parf
;
double
pard
;
char
pars
[
DLF_MAX_PARAMSTRLEN
+
100
];
char
parname
[
DLF_MAX_PARAMNAMELEN
+
10
];
char
pars2
[
DLF_MAX_PARAMSTRLEN
+
100
];
char
parname2
[
DLF_MAX_PARAMNAMELEN
+
10
];
while
(
1
)
{
/* usleep doesn't provide a high enough accuracy and is highly dependant on the scheduler.
* To compensate we hold internal variables discribing the throughput rate per second. If
* the throughput exceeds the desired amount we sleep for a while
*/
if
(
now
==
time
(
NULL
))
{
if
(
throughput
>=
rate
)
{
usleep
(
1000
);
continue
;
}
}
else
{
now
=
time
(
NULL
);
throughput
=
0
;
}
/* total number of messages reached ? */
if
(
total
!=
0
)
{
Cthread_mutex_lock
(
&
test_mutex
);
if
(
count
>=
total
)
{
Cthread_mutex_unlock
(
&
test_mutex
);
break
;
}
count
++
;
generated
++
;
Cthread_mutex_unlock
(
&
test_mutex
);
}
/* generate message */
Cuuid_create
(
&
req_id
);
Cuuid_create
(
&
subreq_id
);
severity
=
1
+
(
int
)
(
7
.
0
*
rand
()
/
(
RAND_MAX
+
1
.
0
));
msg_no
=
1
+
(
int
)
(
255
.
0
*
rand
()
/
(
RAND_MAX
+
1
.
0
));
tpnum
=
1
+
(
int
)
(
9999
.
0
*
rand
()
/
(
RAND_MAX
+
1
.
0
));
snprintf
(
tpname
,
sizeof
(
tpname
),
"TP%04d"
,
tpnum
);
nsfileid
.
fileid
=
((
U_HYPER
)(
0XF1234567
)
<<
32
)
+
0X87654321
;
pari
=
32768
;
pari64
=
((
U_HYPER
)(
0X12345678
)
<<
32
)
+
0X87654321
;
parf
=
32
.
768332
;
pard
=
35
.
535
;
if
(
!
extensive
)
{
rv
=
dlf_write
(
req_id
,
severity
,
msg_no
,
&
nsfileid
,
6
,
" String
\n
"
,
DLF_MSG_PARAM_STR
,
"This is a string!
\n
hdhdhd "
,
NULL
,
DLF_MSG_PARAM_UUID
,
subreq_id
,
" Integer
\t
64 "
,
DLF_MSG_PARAM_INT64
,
pari64
,
NULL
,
DLF_MSG_PARAM_TPVID
,
tpname
,
" Double "
,
DLF_MSG_PARAM_DOUBLE
,
pard
,
" Float "
,
DLF_MSG_PARAM_FLOAT
,
parf
);
}
else
{
/* generate string values designed to overflow the internal buffers */
genstring
(
pars
,
sizeof
(
pars
)
-
1
);
genstring
(
parname
,
sizeof
(
parname
)
-
1
);
genstring
(
tpname
,
sizeof
(
tpname
)
-
1
);
genstring
(
pars2
,
sizeof
(
pars2
)
-
1
);
genstring
(
parname2
,
sizeof
(
parname2
)
-
1
);
rv
=
dlf_write
(
req_id
,
severity
,
msg_no
,
&
nsfileid
,
13
,
parname
,
DLF_MSG_PARAM_STR
,
pars
,
parname2
,
DLF_MSG_PARAM_STR
,
pars2
,
parname
,
DLF_MSG_PARAM_STR
,
pars
,
parname2
,
DLF_MSG_PARAM_STR
,
pars2
,
parname
,
DLF_MSG_PARAM_STR
,
pars
,
parname2
,
DLF_MSG_PARAM_STR
,
pars2
,
NULL
,
DLF_MSG_PARAM_UUID
,
subreq_id
,
parname
,
DLF_MSG_PARAM_INT64
,
pari64
,
NULL
,
DLF_MSG_PARAM_TPVID
,
tpname
,
parname
,
DLF_MSG_PARAM_DOUBLE
,
pard
,
parname
,
DLF_MSG_PARAM_FLOAT
,
parf
,
parname
,
DLF_MSG_PARAM_STR
,
pars
,
parname2
,
DLF_MSG_PARAM_STR
,
pars2
,
parname
,
DLF_MSG_PARAM_STR
,
pars
);
}
throughput
++
;
if
(
rv
<
0
)
{
fprintf
(
stderr
,
"Thread: %d - failed to dlf_write()
\n
"
,
Cthread_self
());
}
}
printf
(
"Thread %d exiting - (%d messages generated)
\n
"
,
Cthread_self
(),
generated
);
/* exit */
Cthread_exit
(
0
);
}
/*
* Main
*/
int
main
(
int
argc
,
char
**
argv
)
{
/* variables */
struct
timeval
start
;
struct
timeval
end
;
char
msgtext
[
DLF_MAX_PARAMSTRLEN
];
char
c
;
char
*
facility
=
strdup
(
"dlftest"
);
int
rv
;
int
i
;
int
*
tid
;
int
*
status
;
int
threads
;
int
daemonise
=
0
;
/* initialise variables to defaults */
threads
=
DEFAULT_THREAD_COUNT
;
total
=
DEFAULT_MSG_TOTAL
;
gettimeofday
(
&
start
,
NULL
);
/* process options */
while
((
c
=
getopt
(
argc
,
argv
,
"ht:r:n:xf:D"
))
!=
-
1
)
{
switch
(
c
)
{
case
'h'
:
printf
(
"Usage: %s [OPTIONS]
\n
"
,
argv
[
0
]);
printf
(
"The following options are available:
\n\n
"
);
printf
(
" -h display this help and exit
\n
"
);
printf
(
" -t <int> number of producer threads to create
\n
"
);
printf
(
" -r <int> number of messages per second
\n
"
);
printf
(
" -x extensive test designed to crash the api
\n
"
);
printf
(
" -n number of messages to generate before exiting
\n
"
);
printf
(
" -f <name> name of the facility, default DLFTest
\n
"
);
printf
(
" -D fork the process into the background
\n
"
);
printf
(
"
\n
Report bugs to castor.support@cern.ch
\n
"
);
return
0
;
case
't'
:
threads
=
atoi
(
optarg
);
break
;
case
'r'
:
rate
=
atoi
(
optarg
);
break
;
case
'x'
:
extensive
=
1
;
break
;
case
'n'
:
total
=
atoi
(
optarg
);
break
;
case
'f'
:
free
(
facility
);
facility
=
strdup
(
optarg
);
break
;
case
'D'
:
daemonise
=
1
;
break
;
case
':'
:
return
-
1
;
/* missing parameter */
case
'?'
:
return
-
1
;
/* unknown parameter */
}
}
/* initialise interface
* - note: the facility should be registered prior to the test, self registration from a client
* is not supported!!
*/
rv
=
dlf_init
(
facility
);
if
(
rv
!=
0
)
{
fprintf
(
stderr
,
"dlf_init() - %s
\n
"
,
strerror
(
errno
));
free
(
facility
);
return
-
1
;
}
/* initialise castor thread interface */
Cthread_init
();
/* the interface will not work correctly unless message texts have been registered to the api
* prior to the first call to dlf_write() or dlf_writep()
*/
for
(
i
=
1
;
i
<=
255
;
i
++
)
{
snprintf
(
msgtext
,
DLF_MAX_PARAMSTRLEN
,
"This is message text %d"
,
i
);
rv
=
dlf_regtext
(
i
,
msgtext
);
if
(
rv
<
0
)
{
fprintf
(
stderr
,
"Failed to dlf_regtext() %d:%s
\n
"
,
i
,
msgtext
);
free
(
facility
);
return
-
1
;
}
}
/* allocate memory to hold thread ids */
tid
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
threads
);
if
(
tid
==
NULL
)
{
fprintf
(
stderr
,
"Failed to malloc thread id array : %s
\n
"
,
strerror
(
errno
));
free
(
facility
);
return
-
1
;
}
/* daemonise the process ? */
if
(
daemonise
==
1
)
{
rv
=
fork
();
if
(
rv
<
0
)
{
fprintf
(
stderr
,
"dlftest: failed to fork() : %s
\n
"
,
strerror
(
errno
));
return
1
;
}
else
if
(
rv
>
0
)
{
return
0
;
}
setsid
();
fclose
(
stdin
);
fclose
(
stdout
);
fclose
(
stderr
);
}
/* startup message */
printf
(
"-------------------------------------------------------------------------------------
\n
"
);
printf
(
"Test started with %d thread%s generating %d message%s per second
\n
"
,
threads
,
threads
==
1
?
""
:
"s"
,
rate
*
threads
,
rate
*
threads
==
1
?
""
:
"s"
);
printf
(
"Facility name: %s
\n
"
,
facility
);
printf
(
"-------------------------------------------------------------------------------------
\n
"
);
/* create the thread pool */
for
(
i
=
0
;
i
<
threads
;
i
++
)
{
tid
[
i
]
=
Cthread_create
((
void
*
(
*
)(
void
*
))
worker
,
NULL
);
if
(
tid
[
i
]
==
-
1
)
{
printf
(
"Failed to Cthread_create_detached() - %s
\n
"
,
sstrerror
(
errno
));
}
}
/* wait for the threads to finish */
for
(
i
=
0
;
i
<
threads
;
i
++
)
{
Cthread_join
(
tid
[
i
],
&
status
);
}
free
(
tid
);
free
(
facility
);
printf
(
"
\n
All threads exited
\n
"
);
gettimeofday
(
&
end
,
NULL
);
/* shutdown the interface */
rv
=
dlf_shutdown
();
if
(
rv
<
0
)
{
fprintf
(
stderr
,
"Failed to dlf_shutdown()
\n
"
);
return
-
1
;
}
printf
(
"-------------------------------------------------------------------------------------
\n
"
);
printf
(
"Generated %d messages in %.3f seconds
\n
"
,
count
,
(((
double
)
end
.
tv_sec
*
1000
)
+
((
double
)
end
.
tv_usec
/
1000
)
-
((
double
)
start
.
tv_sec
*
1000
)
+
((
double
)
start
.
tv_usec
/
1000
))
/
1000
);
return
0
;
}
/** End-of-File **/
This diff is collapsed.
Click to expand it.
test/dlf/prepare.py
deleted
100644 → 0
+
0
−
123
View file @
9a02dced
#/******************************************************************************
# * prepare.py
# *
# * This file is part of the Castor project.
# * See http://castor.web.cern.ch/castor
# *
# * Copyright (C) 2003 CERN
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation; either version 2
# * of the License, or (at your option) any later version.
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# *
# *
# * script gathering a consistent set of logs from a given castor
# * instance so that the logging activity of the instance can be replayed
# * by the dlftest program.
# *
# * @author Castor Dev team, castor-dev@cern.ch
# *****************************************************************************/
import
sys
,
os
,
time
# list of log files per facility, and whether it is a server log file
logfiles
=
{
'
RequestHandler
'
:
(
'
rhserver
'
,
'
log
'
,
True
),
'
TapeErrorHandler
'
:
(
'
rtcpclientd
'
,
'
TapeErrorHandler
'
,
True
),
'
Stager
'
:
(
'
stager
'
,
'
log
'
,
True
),
'
Scheduler
'
:
(
'
scheduler
'
,
'
log
'
,
True
),
'
Job
'
:
(
'
job
'
,
'
log
'
,
False
),
'
DiskCopy
'
:
(
'
job
'
,
'
diskcopy
'
,
False
),
'
GC
'
:
(
'
gc
'
,
'
log
'
,
False
),
'
TransferManager
'
:
(
'
transfermanagerd
'
,
'
log
'
,
True
),
'
TapeGateway
'
:
(
'
tapegatewayd
'
,
'
log
'
,
True
)
}
def
usage
():
print
sys
.
argv
[
0
]
+
"
<instance> [date YYMMDD]
"
# check arguments
if
len
(
sys
.
argv
)
!=
2
and
len
(
sys
.
argv
)
!=
3
:
print
"
wrong number of arguments
"
usage
()
sys
.
exit
(
1
)
instance
=
sys
.
argv
[
1
]
lognb
=
0
if
len
(
sys
.
argv
)
==
3
:
try
:
time
.
strptime
(
sys
.
argv
[
2
],
"
%y%m%d
"
)
logday
=
sys
.
argv
[
2
]
except
ValueError
:
print
"
second argument should be a date in TTMMDD format
"
usage
()
sys
.
exit
(
1
)
else
:
logday
=
time
.
strftime
(
"
%y%m%d
"
,
time
.
localtime
())
# get list of machines to deal with
cmd
=
'
wassh -c c2
'
+
instance
+
'
--list
'
f
=
os
.
popen
(
cmd
)
machines
=
f
.
read
().
split
()
if
(
f
.
close
()
!=
None
):
print
"
Failed running :
"
+
cmd
print
"
Exiting
"
sys
.
exit
(
1
)
smachines
=
[]
dmachines
=
[]
for
m
in
machines
:
if
m
[
0
:
2
]
==
'
c2
'
:
smachines
.
append
(
m
)
else
:
dmachines
.
append
(
m
)
# get the files
for
fac
in
logfiles
.
keys
():
print
"
Gathering log files for
"
+
fac
+
'
facility...
'
d
=
'
fac_
'
+
fac
try
:
os
.
mkdir
(
d
)
except
OSError
:
None
fulld
=
os
.
getcwd
()
+
'
/
'
+
d
log
=
logfiles
[
fac
][
0
]
+
'
/
'
+
logfiles
[
fac
][
1
]
if
logfiles
[
fac
][
2
]:
ms
=
smachines
else
:
ms
=
dmachines
for
m
in
ms
:
# find the file on the machine for that facility is there is one
cmd
=
'
ssh -q -o
"
StrictHostKeyChecking no
"
'
+
m
+
'
"
ls --time-style=+dateis%y%m%d /var/spool/
'
+
log
+
'
* -l -t -r | grep dateis
'
+
logday
+
'
| tail -1
"'
f
,
g
,
h
=
os
.
popen3
(
cmd
)
errors
=
h
.
read
()
if
len
(
errors
)
>
0
:
if
errors
.
find
(
"
No match
"
)
==
-
1
:
print
"
failed to find logs on machine
"
+
m
print
output
continue
# get the file
output
=
g
.
readlines
()
if
len
(
output
)
==
0
:
continue
output
=
output
[
0
].
split
()
filename
=
output
[
len
(
output
)
-
1
]
cmd
=
'
scp -o
"
StrictHostKeyChecking no
"
'
+
m
+
"
:
"
+
filename
+
"
"
+
fulld
+
'
/
'
+
m
+
'
.
'
+
os
.
path
.
basename
(
filename
)
print
"
transfering
"
+
d
+
'
/
'
+
m
+
'
.
'
+
os
.
path
.
basename
(
filename
)
f
,
g
,
h
=
os
.
popen3
(
cmd
)
output
=
h
.
read
()
if
len
(
output
)
>
0
:
print
"
Transfer failed :
"
print
output
for
f
in
os
.
listdir
(
fulld
):
if
f
.
endswith
(
'
.gz
'
):
cmd
=
'
gunzip
'
+
fulld
+
'
/
'
+
f
h
=
os
.
popen
(
cmd
)
h
.
read
()
if
(
h
.
close
()
!=
None
):
print
"
failed to unzip
'"
+
f
+
"'"
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