Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
79e58421
Commit
79e58421
authored
Apr 02, 2014
by
Manuel Pégourié-Gonnard
Browse files
Also test net_usleep in timing_selttest()
parent
edb242fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
library/timing.c
library/timing.c
+32
-2
No files found.
library/timing.c
View file @
79e58421
...
...
@@ -319,6 +319,11 @@ void m_sleep( int milliseconds )
#if defined(POLARSSL_SELF_TEST)
/* To test net_usleep against our functions */
#if defined(POLARSSL_NET_C)
#include "polarssl/net.h"
#endif
/*
* Checkup routine
*/
...
...
@@ -339,11 +344,11 @@ int timing_self_test( int verbose )
{
(
void
)
get_timer
(
&
hires
,
1
);
m_sleep
(
10
00
*
secs
);
m_sleep
(
5
00
*
secs
);
millisecs
=
get_timer
(
&
hires
,
0
);
if
(
millisecs
<
90
0
*
secs
||
millisecs
>
110
0
*
secs
)
if
(
millisecs
<
45
0
*
secs
||
millisecs
>
55
0
*
secs
)
{
if
(
verbose
!=
0
)
polarssl_printf
(
"failed
\n
"
);
...
...
@@ -426,6 +431,31 @@ hard_test:
if
(
verbose
!=
0
)
polarssl_printf
(
"
\n
"
);
#if defined(POLARSSL_NET_C)
if
(
verbose
!=
0
)
polarssl_printf
(
" TIMING test #4 (net_usleep/ get_timer): "
);
for
(
secs
=
1
;
secs
<=
3
;
secs
++
)
{
(
void
)
get_timer
(
&
hires
,
1
);
net_usleep
(
500000
*
secs
);
millisecs
=
get_timer
(
&
hires
,
0
);
if
(
millisecs
<
450
*
secs
||
millisecs
>
550
*
secs
)
{
if
(
verbose
!=
0
)
polarssl_printf
(
"failed
\n
"
);
return
(
1
);
}
}
if
(
verbose
!=
0
)
polarssl_printf
(
"passed
\n
"
);
#endif
return
(
0
);
}
...
...
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