Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
magic-lantern
magic-lantern
Commits
d78f841fa972
Commit
6cae045f
authored
Mar 27, 2019
by
alex@thinkpad
Browse files
qemu-fio: burn-in test for FindClose
(FindFirst/FindClose/FindNext repeated many times) --HG-- branch : qemu
parent
8aec143588a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
contrib/qemu/tests/run_tests.sh
View file @
d78f841f
...
...
@@ -1167,14 +1167,15 @@ function test_fio {
touch
tests/
$CAM
/
$TEST
.log
(
timeout
20
tail
-f
-n100000
tests/
$CAM
/
$TEST
.log &
)
|
grep
-aq
"timestamp"
# let it run for
2
seconds
sleep
2
# let it run for
5
seconds
sleep
5
stop_qemu_expect_running
tac
tests/
$CAM
/
$TEST
.log
>
tests/
$CAM
/
$TEST
-rev
.log
tests/check_grep.sh tests/
$CAM
/
$TEST
-rev
.log
-Em1
"Trying (SD|CF) card..."
printf
" "
;
tests/check_grep.sh tests/
$CAM
/
$TEST
-rev
.log
-m1
--
"--> DCIM"
||
return
printf
" "
;
tests/check_grep.sh tests/
$CAM
/
$TEST
-rev
.log
-m1
--
"--> AUTOEXEC.BIN"
||
return
printf
" "
;
tests/check_grep.sh tests/
$CAM
/
$TEST
-rev
.log
-m1
--
"FIO_FindClose: completed"
||
return
rm
tests/
$CAM
/
$TEST
-rev
.log
}
...
...
minimal/qemu-fio/minimal.c
View file @
d78f841f
...
...
@@ -176,10 +176,15 @@ static const char * format_date( unsigned timestamp )
struct
fio_dirent
*
_FIO_FindFirstEx
(
const
char
*
dirname
,
struct
fio_file
*
file
);
#ifndef GET_DIGIC_TIMER
/* FIXME */
#define GET_DIGIC_TIMER() *(volatile uint32_t*)0xC0242014
/* 20-bit microsecond timer */
#endif
static
void
test_findfirst
()
{
struct
fio_file
file
;
struct
fio_dirent
*
dirent
;
int
card_type
=
-
1
;
/* 0 = CF, 1 = SD */
/* file I/O backend may or may not be started; retry a few times if needed */
for
(
int
i
=
0
;
i
<
10
;
i
++
)
...
...
@@ -187,6 +192,7 @@ static void test_findfirst()
qprintf
(
"Trying SD card...
\n
"
);
dirent
=
_FIO_FindFirstEx
(
"B:/"
,
&
file
);
if
(
!
IS_ERROR
(
dirent
))
{
card_type
=
1
;
break
;
}
else
{
qprintf
(
"FIO_FindFirstEx error %x.
\n
"
,
dirent
);
...
...
@@ -195,6 +201,7 @@ static void test_findfirst()
qprintf
(
"Trying CF card...
\n
"
);
dirent
=
_FIO_FindFirstEx
(
"A:/"
,
&
file
);
if
(
!
IS_ERROR
(
dirent
))
{
card_type
=
0
;
break
;
}
else
{
qprintf
(
"FIO_FindFirstEx error %x.
\n
"
,
dirent
);
...
...
@@ -202,6 +209,12 @@ static void test_findfirst()
msleep
(
500
);
}
if
(
card_type
<
0
)
{
qprintf
(
"FIO_FindFirst test failed.
\n
"
);
return
;
}
qprintf
(
" filename size mode timestamp
\n
"
);
do
{
/* FIXME: %12s not working */
...
...
@@ -210,6 +223,35 @@ static void test_findfirst()
qprintf
(
"--> %s %08x %08x %s
\n
"
,
file_name
,
file
.
size
,
file
.
mode
,
format_date
(
file
.
timestamp
));
}
while
(
FIO_FindNextEx
(
dirent
,
&
file
)
==
0
);
FIO_FindClose
(
dirent
);
/* test for FindClose */
/* keep run for 2 seconds, and report how many iterations it performed */
/* card emulation speed in QEMU varies a lot across different models,
* sometimes by as much as 2 orders of magnitude */
int
i
=
0
;
uint32_t
elapsed_time
=
0
;
uint32_t
last
=
GET_DIGIC_TIMER
();
while
(
elapsed_time
<
2000000
)
{
uint32_t
now
=
GET_DIGIC_TIMER
();
elapsed_time
+=
(
now
<<
12
)
-
(
last
<<
12
)
>>
12
;
last
=
now
;
i
++
;
dirent
=
_FIO_FindFirstEx
(
card_type
==
1
?
"B:/"
:
"A:/"
,
&
file
);
if
(
IS_ERROR
(
dirent
))
{
qprintf
(
"FIO_FindFirstEx error %x at iteration %d.
\n
"
,
dirent
,
i
);
return
;
}
/* iterate through some of the files, but not necessarily all of them */
for
(
int
j
=
0
;
j
<
i
%
16
;
j
++
)
{
if
(
FIO_FindNextEx
(
dirent
,
&
file
))
break
;
}
/* commenting out FindClose will fail the test (too many open handles) */
FIO_FindClose
(
dirent
);
}
qprintf
(
"FIO_FindClose: completed %d iterations.
\n
"
,
i
);
}
/** Initial task setup.
...
...
Write
Preview
Supports
Markdown
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