Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
785bcc17
Commit
785bcc17
authored
Oct 20, 2010
by
Davi Arnaut
Browse files
Options
Browse Files
Download
Plain Diff
Merge of mysql-5.1-bugteam into mysql-5.5-bugteam.
parents
7af50942
b5bb13ec
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
37 deletions
+60
-37
include/my_pthread.h
include/my_pthread.h
+2
-1
mysys/my_gethwaddr.c
mysys/my_gethwaddr.c
+13
-19
mysys/thr_mutex.c
mysys/thr_mutex.c
+2
-2
unittest/examples/skip-t.c
unittest/examples/skip-t.c
+4
-4
unittest/examples/skip_all-t.c
unittest/examples/skip_all-t.c
+4
-4
unittest/examples/todo-t.c
unittest/examples/todo-t.c
+4
-4
unittest/mytap/t/basic-t.c
unittest/mytap/t/basic-t.c
+1
-1
unittest/mytap/tap.c
unittest/mytap/tap.c
+17
-0
unittest/mytap/tap.h
unittest/mytap/tap.h
+13
-2
No files found.
include/my_pthread.h
View file @
785bcc17
...
...
@@ -501,7 +501,8 @@ int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int
safe_cond_wait
(
pthread_cond_t
*
cond
,
safe_mutex_t
*
mp
,
const
char
*
file
,
uint
line
);
int
safe_cond_timedwait
(
pthread_cond_t
*
cond
,
safe_mutex_t
*
mp
,
struct
timespec
*
abstime
,
const
char
*
file
,
uint
line
);
const
struct
timespec
*
abstime
,
const
char
*
file
,
uint
line
);
void
safe_mutex_global_init
(
void
);
void
safe_mutex_end
(
FILE
*
file
);
...
...
mysys/my_gethwaddr.c
View file @
785bcc17
...
...
@@ -21,18 +21,6 @@
#ifndef MAIN
#if defined(__FreeBSD__) || defined(__linux__)
static
my_bool
memcpy_and_test
(
uchar
*
to
,
uchar
*
from
,
uint
len
)
{
uint
i
,
res
=
1
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
*
to
++=
*
from
++
))
res
=
0
;
return
res
;
}
#endif
/* FreeBSD || linux */
#ifdef __FreeBSD__
#include <net/ethernet.h>
...
...
@@ -44,10 +32,11 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
my_bool
my_gethwaddr
(
uchar
*
to
)
{
size_t
len
;
uchar
*
buf
,
*
next
,
*
end
,
*
addr
;
char
*
buf
,
*
next
,
*
end
;
struct
if_msghdr
*
ifm
;
struct
sockaddr_dl
*
sdl
;
int
res
=
1
,
mib
[
6
]
=
{
CTL_NET
,
AF_ROUTE
,
0
,
AF_LINK
,
NET_RT_IFLIST
,
0
};
char
zero_array
[
ETHER_ADDR_LEN
]
=
{
0
};
if
(
sysctl
(
mib
,
6
,
NULL
,
&
len
,
NULL
,
0
)
==
-
1
)
goto
err
;
...
...
@@ -63,9 +52,9 @@ my_bool my_gethwaddr(uchar *to)
ifm
=
(
struct
if_msghdr
*
)
next
;
if
(
ifm
->
ifm_type
==
RTM_IFINFO
)
{
sdl
=
(
struct
sockaddr_dl
*
)(
ifm
+
1
);
addr
=
(
uchar
*
)
LLADDR
(
sdl
);
res
=
memcpy_and_test
(
to
,
addr
,
ETHER_ADDR_LEN
)
;
sdl
=
(
struct
sockaddr_dl
*
)(
ifm
+
1
);
memcpy
(
to
,
LLADDR
(
sdl
),
ETHER_ADDR_LEN
);
res
=
memcmp
(
to
,
zero_array
,
ETHER_ADDR_LEN
)
?
0
:
1
;
}
}
...
...
@@ -81,8 +70,9 @@ my_bool my_gethwaddr(uchar *to)
my_bool
my_gethwaddr
(
uchar
*
to
)
{
int
fd
,
res
=
1
;
int
fd
,
res
=
1
;
struct
ifreq
ifr
;
char
zero_array
[
ETHER_ADDR_LEN
]
=
{
0
};
fd
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
if
(
fd
<
0
)
...
...
@@ -91,9 +81,13 @@ my_bool my_gethwaddr(uchar *to)
bzero
(
&
ifr
,
sizeof
(
ifr
));
strnmov
(
ifr
.
ifr_name
,
"eth0"
,
sizeof
(
ifr
.
ifr_name
)
-
1
);
do
{
do
{
if
(
ioctl
(
fd
,
SIOCGIFHWADDR
,
&
ifr
)
>=
0
)
res
=
memcpy_and_test
(
to
,
(
uchar
*
)
&
ifr
.
ifr_hwaddr
.
sa_data
,
ETHER_ADDR_LEN
);
{
memcpy
(
to
,
&
ifr
.
ifr_hwaddr
.
sa_data
,
ETHER_ADDR_LEN
);
res
=
memcmp
(
to
,
zero_array
,
ETHER_ADDR_LEN
)
?
0
:
1
;
}
}
while
(
res
&&
(
errno
==
0
||
errno
==
ENODEV
)
&&
ifr
.
ifr_name
[
3
]
++
<
'6'
);
close
(
fd
);
...
...
mysys/thr_mutex.c
View file @
785bcc17
...
...
@@ -262,8 +262,8 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
int
safe_cond_timedwait
(
pthread_cond_t
*
cond
,
safe_mutex_t
*
mp
,
struct
timespec
*
abstime
,
const
char
*
file
,
uint
line
)
const
struct
timespec
*
abstime
,
const
char
*
file
,
uint
line
)
{
int
error
;
pthread_mutex_lock
(
&
mp
->
global
);
...
...
unittest/examples/skip-t.c
View file @
785bcc17
...
...
@@ -18,11 +18,11 @@
int
main
()
{
plan
(
4
);
ok
(
1
,
NULL
);
ok
(
1
,
NULL
);
ok
1
(
1
);
ok
1
(
1
);
SKIP_BLOCK_IF
(
1
,
2
,
"Example of skipping a few test points in a test"
)
{
ok
(
1
,
NULL
);
ok
(
1
,
NULL
);
ok
1
(
1
);
ok
1
(
1
);
}
return
exit_status
();
}
unittest/examples/skip_all-t.c
View file @
785bcc17
...
...
@@ -31,9 +31,9 @@ int main() {
if
(
!
has_feature
())
skip_all
(
"Example of skipping an entire test"
);
plan
(
4
);
ok
(
1
,
NULL
);
ok
(
1
,
NULL
);
ok
(
1
,
NULL
);
ok
(
1
,
NULL
);
ok
1
(
1
);
ok
1
(
1
);
ok
1
(
1
);
ok
1
(
1
);
return
exit_status
();
}
unittest/examples/todo-t.c
View file @
785bcc17
...
...
@@ -21,15 +21,15 @@
int
main
()
{
plan
(
4
);
ok
(
1
,
NULL
);
ok
(
1
,
NULL
);
ok
1
(
1
);
ok
1
(
1
);
/*
Tests in the todo region is expected to fail. If they don't,
something is strange.
*/
todo_start
(
"Need to fix these"
);
ok
(
0
,
NULL
);
ok
(
0
,
NULL
);
ok
1
(
0
);
ok
1
(
0
);
todo_end
();
return
exit_status
();
}
unittest/mytap/t/basic-t.c
View file @
785bcc17
...
...
@@ -22,7 +22,7 @@ int main() {
plan
(
5
);
ok
(
1
==
1
,
"testing basic functions"
);
ok
(
2
==
2
,
" "
);
ok
(
3
==
3
,
NULL
);
ok
1
(
3
==
3
);
if
(
1
==
1
)
skip
(
2
,
"Sensa fragoli"
);
else
{
...
...
unittest/mytap/tap.c
View file @
785bcc17
...
...
@@ -244,6 +244,23 @@ ok(int pass, char const *fmt, ...)
emit_endl
();
}
void
ok1
(
int
const
pass
)
{
va_list
ap
;
memset
(
&
ap
,
0
,
sizeof
(
ap
));
if
(
!
pass
&&
*
g_test
.
todo
==
'\0'
)
++
g_test
.
failed
;
vemit_tap
(
pass
,
NULL
,
ap
);
if
(
*
g_test
.
todo
!=
'\0'
)
emit_dir
(
"todo"
,
g_test
.
todo
);
emit_endl
();
}
void
skip
(
int
how_many
,
char
const
*
fmt
,
...)
...
...
unittest/mytap/tap.h
View file @
785bcc17
...
...
@@ -121,14 +121,25 @@ void plan(int const count);
@endcode
@param pass Zero if the test failed, non-zero if it passed.
@param fmt Format string in printf() format. NULL is
allowed, in
which case nothing is printed
.
@param fmt Format string in printf() format. NULL is
not allowed,
use ok1() in this case
.
*/
void
ok
(
int
const
pass
,
char
const
*
fmt
,
...)
__attribute__
((
format
(
printf
,
2
,
3
)));
/**
Report test result as a TAP line.
Same as ok() but does not take a message to be printed.
@param pass Zero if the test failed, non-zero if it passed.
*/
void
ok1
(
int
const
pass
);
/**
Skip a determined number of tests.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment