Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
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
Service Desk
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
Jonas Leder
marlin-anet-a8
Commits
d4c210f2
Commit
d4c210f2
authored
5 years ago
by
Scott Lahteine
Browse files
Options
Downloads
Patches
Plain Diff
Fix and improve mftest
parent
44c8f29e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildroot/share/git/mftest
+36
-16
36 additions, 16 deletions
buildroot/share/git/mftest
with
36 additions
and
16 deletions
buildroot/share/git/mftest
+
36
−
16
View file @
d4c210f2
...
...
@@ -14,8 +14,10 @@ TESTPATH=buildroot/share/tests
shopt
-s
extglob nocasematch
# Get test, allowing shorthand
TESTENV
=
${
1
:-
"mega"
}
# Get test
TESTENV
=
${
1
:-
'-'
}
# Allow shorthand for test name
case
$TESTENV
in
due
)
TESTENV
=
'DUE'
;;
esp
)
TESTENV
=
'esp32'
;;
...
...
@@ -26,6 +28,7 @@ case $TESTENV in
stm
)
TESTENV
=
'STM32F1'
;;
t35
)
TESTENV
=
'teensy35'
;;
teensy
)
TESTENV
=
'teensy35'
;;
-
)
;;
esac
# Matching patterns
...
...
@@ -34,7 +37,7 @@ ISCMD='^(restore|opt|exec|use|pins|env)_'
ISEXEC
=
'^exec_'
# List available tests and ask for selection
if
[[
$
1
==
'-'
]]
;
then
if
[[
$
TESTENV
==
'-'
]]
;
then
IND
=
0
NAMES
=()
for
FILE
in
$(
ls
-1
$TESTPATH
/
*
-tests
)
...
...
@@ -43,6 +46,7 @@ if [[ $1 == '-' ]]; then
TNAME
=
${
FILE
/-tests/
}
TNAME
=
${
TNAME
/
$TESTPATH
\//
}
NAMES+
=(
$TNAME
)
((
IND < 10
))
&&
echo
-n
" "
echo
"
$IND
)
$TNAME
"
done
...
...
@@ -50,8 +54,8 @@ if [[ $1 == '-' ]]; then
for
((
;
;
))
do
read
-p
"Select a test to apply (1-
$IND
) : "
NAMEIND
[[
-z
"
$NAMEIND
"
]]
&&
{
echo
"Quitting."
;
exit
1
;
}
[[
$NAMEIND
=
~
$ISNUM
]]
&&
((
NAMEIND
>=
1
&&
NAMEIND <
=
IND
))
&&
{
TESTENV
=
${
NAMES
[
$NAMEIND
-1]
}
;
break
;
}
[[
-z
"
$NAMEIND
"
]]
&&
{
echo
'(canceled)'
;
exit
1
;
}
[[
$NAMEIND
=
~
$ISNUM
]]
&&
((
NAMEIND
>=
1
&&
NAMEIND <
=
IND
))
&&
{
TESTENV
=
${
NAMES
[
$NAMEIND
-1]
}
;
echo
;
break
;
}
echo
"Invalid selection."
done
fi
...
...
@@ -66,17 +70,33 @@ TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
# Get the entered or interactive test index
CHOICE
=
${
2
:-
0
}
if
[[
$TESTCOUNT
>
1
&&
(
$CHOICE
==
0
||
$1
==
'-'
)
]]
;
then
# User entered a number?
((
CHOICE
&&
CHOICE
>
TESTCOUNT
))
&&
{
echo
"Invalid test index '
$CHOICE
' (1-
$TESTCOUNT
)."
;
exit
1
;
}
if
[[
$CHOICE
==
0
]]
;
then
# List test descriptions with numbers
echo
"Available '
$TESTENV
' tests:"
;
echo
"
$OUT
"
|
{
IND
=
0
SED
=
$(
which gsed
||
which
sed
)
while
IFS
=
read
-r
LINE
do
if
[[
$LINE
=
~
$ISEXEC
]]
;
then
DESC
=
$(
"
$SED
"
-E
's/^.+"(.*)".*$/\1/g'
<<<
"
$LINE
"
)
((
++IND < 10
))
&&
echo
-n
" "
echo
"
$IND
)
$DESC
"
fi
done
}
CHOICE
=
1
if
[[
$TESTCOUNT
>
1
]]
;
then
for
((
;
;
))
do
read
-p
"
Test
'
$TESTENV
'
index
(1-
$TESTCOUNT
) : "
CHOICE
[[
-z
"
$CHOICE
"
]]
&&
CHOICE
=
1
read
-p
"
Select a
'
$TESTENV
'
test
(1-
$TESTCOUNT
) : "
CHOICE
[[
-z
"
$CHOICE
"
]]
&&
{
echo
'(canceled)'
;
exit
1
;
}
[[
$CHOICE
=
~
$ISNUM
]]
&&
((
CHOICE
>=
1
&&
CHOICE <
=
TESTCOUNT
))
&&
break
echo
"Invalid test index '
$CHOICE
'."
echo
"
>>>
Invalid test index '
$CHOICE
'."
done
else
# Confirm a manually-entered test index
((
CHOICE
>=
1
&&
CHOICE <
=
TESTCOUNT
))
||
{
echo
"Invalid test index '
$CHOICE
' (1-
$TESTCOUNT
)."
;
exit
1
;
}
fi
fi
# Finally, run the specified test lines
...
...
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