Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
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
Container Registry
Model registry
Operate
Environments
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
Main Repositories
otb
Commits
754d2806
Commit
754d2806
authored
8 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ADD: script for windows package testing (WIP)
parent
32299be2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SuperBuild/Packaging/Files/selftester.bat
+189
-0
189 additions, 0 deletions
SuperBuild/Packaging/Files/selftester.bat
with
189 additions
and
0 deletions
SuperBuild/Packaging/Files/selftester.bat
0 → 100755
+
189
−
0
View file @
754d2806
@echo
off
setlocal
set
CURRENT_SCRIPT_DIR
=
%~dp0
set
DIRNAME
=
%CURRENT_SCRIPT_DIR%
..
cd
%DIRNAME%
:: Get current PID
type
NUL
>
pid
.log
wmic
PROCESS
where
"Name='WMIC.exe'"
get
ParentProcessId
>
pid
.log
2
>&
1
for
/F
"TOKENS=1"
%%b
in
(
'type pid.log
^|
findstr [0-9]'
)
do
set
CURRENT_PID
=
%%b
:: setup the otbenv
:: call otbenv.cmd
del
selftest_report
.log
type
NUL
>
selftest_report
.log
call
:nb
_report_lines
set
REF_SIZE
=
%nb_report_lines_out%
rem Check 1 : check binaries
for
/R
%%i
in
(*
.dll
)
do
(
call
:check
_binary
%%i
)
for
%%i
in
(
bin
\mapla.exe
,
bin
\monteverdi.exe
,
bin
\otbApplicationLauncherCommandLine.exe
,
bin
\otbApplicationLauncherQt.exe
)
do
(
call
:check
_binary
%%i
)
call
:nb
_report_lines
if
%nb_report_lines_out%
gtr
%REF_SIZE%
(
echo
Check
1
/3 :
FAIL
rem should exit here
rem goto :eof
)
else
(
echo
Check
1
/3 :
PASS
)
set
REF_SIZE
=
%nb_report_lines_out%
rem Check 2 : check applications and Python wrapping
set
/a
app_count
=
0
for
/R
%%i
in
(
lib
\otb\applications\otbapp_
*
.dll
)
do
(
call
:check
_application
%%i
)
if
%app_count%
leq
90
(
echo
WARNING
:
only
%app_count%
applications
found
!
Expected
at
least
90
)
call
:nb
_report_lines
if
%nb_report_lines_out%
gtr
%REF_SIZE%
(
echo
Check
2
/3 :
FAIL
)
else
(
echo
Check
2
/3 :
PASS
)
set
REF_SIZE
=
%nb_report_lines_out%
rem Check 3 : check monteverdi & mapla
endlocal
goto
:eof
rem functions :
:check
_binary
setlocal
type
NUL
>
tmp
.log
bin
\otb_loader.exe
%
1
>
tmp
.log
2
>&
1
call
:nb
_tmp_lines
if
%nb_tmp_lines_out%
gtr
0
(
echo
ERROR
:
otb_loader
.exe
%
1
echo
otb_loader
.exe
%
1
>
selftest_report
.log
type
tmp
.log
>
selftest_report
.log
)
endlocal
goto
:eof
:check
_application
setlocal
set
dll_path
=
%~n1
set
app
=
%dll
_path:
~
7
%
if
not
exist
bin
\otbcli_
%app%
.bat
(
echo
ERROR
:
missing
cli
launcher
for
application
%app%
echo
ERROR
:
missing
cli
launcher
for
application
%app%
>
selftest_report
.log
goto
:check
_gui
)
type
NUL
>
tmp
.log
bin
\otbcli_
%app%
.bat
-help
>
tmp
.log
2
>&
1
call
:parse
_cli_output
if
%parse_cli_result%
equ
0
(
echo
ERROR
:
error
launching
application
otbcli_
%app%
echo
ERROR
:
error
launching
application
otbcli_
%app%
>
selftest_report
.log
type
tmp
.log
>
selftest_report
.log
)
:check
_gui
if
not
exist
bin
\otbgui_
%app%
.bat
(
echo
ERROR
:
missing
gui
launcher
for
application
%app%
echo
ERROR
:
missing
gui
launcher
for
application
%app%
>
selftest_report
.log
goto
:check
_application_end
)
if
%app_count%
geq
2
goto
:check
_application_end
type
NUL
>
tmp
.log
start
/b
bin
\otbgui_
%app%
.bat
timeout
5
call
:get
_child_pid
%CURRENT_PID%
cmd.exe
set
first_child
=
0
if
%child_pid%
gtr
1
(
set
first_child
=
%child_pid%
)
else
(
echo
ERROR
:
could
not
launch
otbgui_
%app%
echo
ERROR
:
could
not
launch
otbgui_
%app%
>
selftest_report
.log
goto
:check
_application_clean
)
call
:get
_child_pid
%first_child%
otbApplicationLauncherQt
.exe
if
not
%child_pid%
gtr
1
(
echo
ERROR
:
could
not
launch
otbApplicationLauncherQt
%app%
echo
ERROR
:
could
not
launch
otbApplicationLauncherQt
%app%
>
selftest_report
.log
)
:check
_application_clean
if
not
%first_child%
==
0
(
taskkill
/PID
%first_child%
/F /T
>
NUL
2
>&
1
)
:check
_application_end
endlocal
&
set
/a
app_count
=
app_count
+
1
goto
:eof
:launch
_gui
setlocal
start
/b
bin
\otbgui_
%app%
.bat
endlocal
goto
:eof
:parse
_cli_output
setlocal
set
ret
=
1
for
/F
%%a
in
(
'findstr /n /r /c:"
^T
his is the
%app%
application, version " tmp.log'
)
do
set
output
=
%%a
if
not
"
%output%
"
gtr
"1:"
(
echo
First
line
not
found
set
ret
=
0
goto
:parse
_cli_output_end
)
set
output
=
for
/F
%%a
in
(
'findstr /n /r /c:"
^P
arameters:" tmp.log'
)
do
set
output
=
%%a
if
not
"
%output%
"
gtr
"3:"
(
echo
Parameters
line
not
found
set
ret
=
0
goto
:parse
_cli_output_end
)
set
output
=
for
/F
%%a
in
(
'findstr /n /r /c:"
^E
xamples:" tmp.log'
)
do
set
output
=
%%a
if
not
"
%output%
"
gtr
"1"
(
echo
Examples
line
not
found
echo
%output%
set
ret
=
0
goto
:parse
_cli_output_end
)
set
output
=
for
/F
%%a
in
(
'findstr /n /r /c:"FATAL" tmp.log'
)
do
set
output
=
%%a
if
"
%output%
"
gtr
"1"
(
echo
FATAL
found
echo
%output%
set
ret
=
0
goto
:parse
_cli_output_end
)
:parse
_cli_output_end
endlocal
&
set
parse_cli_result
=
%ret%
goto
:eof
:nb
_report_lines
setlocal
for
/F
"delims="
%%i
in
(
'find /C /V ""
^<
selftest_report.log'
)
do
set
output
=
%%i
endlocal
&
set
nb_report_lines_out
=
%output%
goto
:eof
:nb
_tmp_lines
setlocal
for
/F
"delims="
%%i
in
(
'find /C /V ""
^<
tmp.log'
)
do
set
output
=
%%i
endlocal
&
set
nb_tmp_lines_out
=
%output%
goto
:eof
:get
_child_pid
setlocal
set
parent_pid
=
%
1
set
process_name
=
%
2
set
output
=
0
type
NUL
>
pid
.log
wmic
PROCESS
where
(
ParentProcessId
=
%parent_pid%
AND
Name
=
"
%process_name%
"
)
get
ProcessId
>
pid
.log
2
>&
1
for
/F
"TOKENS=1"
%%a
in
(
'type pid.log
^|
findstr [0-9]'
)
do
set
output
=
%%a
endlocal
&
set
child_pid
=
%output%
goto
:eof
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