This commit is contained in:
Stefan Liebl 2024-08-29 16:47:57 +02:00
parent 9bd06a049b
commit cd0581a95e

View File

@ -312,6 +312,10 @@ function! s:Make(args, async_mode)
if options =~ '--device-ip' && '--device-ip' !~ l:args
let l:args .= ' --device-ip='.g:DeviceIP
endif
" Add --config=Debug
if options =~ '--config' && '--config' !~ l:args
let l:args .= ' --config=Debug'
endif
let &makeprg = l:makeprg
execute 'AsyncRun -mode='.a:async_mode.' -save=2 -program=make @ '.l:args
@ -387,117 +391,51 @@ endfunction
" ================
" Regression Tests
" ================
function! g:DlcproRegtestCmd(arguments)
return s:DlcproRegtestCmd('', '', '0', '1', '', '--capture=no', a:arguments)
endfunction
function! g:DlcproRegtestDlProCmd(arguments)
return s:DlcproRegtestCmd('dlc_pro_proto_050003', 'elab-dlcpro2', '2', '1', 'DLpro', '', a:arguments)
endfunction
function! g:DlcproRegtestTaProCmd(arguments)
return s:DlcproRegtestCmd('dlc_pro_045396', 'elab-dlcpro2', '3', '1', 'TApro', '-m "not usb and not usbstick"', a:arguments)
endfunction
function! g:DlcproRegtestCtlCmd(arguments)
return s:DlcproRegtestCmd('dlc_pro__040120', 'elab-dlcpro2', '1', '1', 'CTL', '-m "not usb and not usbstick"', a:arguments)
endfunction
function! g:DlcproRegtestDualDlCmd(arguments)
return s:DlcproRegtestCmd('dlc_pro_041299', 'elab-dlcpro2', '4', '2', 'DLpro', '-m "not usb and not usbstick"', a:arguments)
endfunction
function! g:DlcproRegtestDualDl1Cmd(arguments)
return s:DlcproRegtestCmd('dlc_pro_041299', 'elab-dlcpro2', '4', '1', 'DLpro', '-m "not usb and not usbstick"', a:arguments)
endfunction
function! g:DlcproRegtestShgProCmd(arguments)
return s:DlcproRegtestCmd('dlc_pro_041355', 'elab-dlcpro2', '7', '1', 'TA-SHGpro', '-m "not usb and not usbstick"', a:arguments)
endfunction
" function! g:DlcproRegtestCmd(arguments)
" return s:DlcproRegtestCmd('', '', '0', '1', '', '--capture=no', a:arguments)
" endfunction
" function! g:DlcproRegtestDlProCmd(arguments)
" return s:DlcproRegtestCmd('dlc_pro_proto_050003', 'elab-dlcpro2', '2', '1', 'DLpro', '', a:arguments)
" endfunction
" function! g:DlcproRegtestTaProCmd(arguments)
" return s:DlcproRegtestCmd('dlc_pro_045396', 'elab-dlcpro2', '3', '1', 'TApro', '-m "not usb and not usbstick"', a:arguments)
" endfunction
" function! g:DlcproRegtestCtlCmd(arguments)
" return s:DlcproRegtestCmd('dlc_pro__040120', 'elab-dlcpro2', '1', '1', 'CTL', '-m "not usb and not usbstick"', a:arguments)
" endfunction
" function! g:DlcproRegtestDualDlCmd(arguments)
" return s:DlcproRegtestCmd('dlc_pro_041299', 'elab-dlcpro2', '4', '2', 'DLpro', '-m "not usb and not usbstick"', a:arguments)
" endfunction
" function! g:DlcproRegtestDualDl1Cmd(arguments)
" return s:DlcproRegtestCmd('dlc_pro_041299', 'elab-dlcpro2', '4', '1', 'DLpro', '-m "not usb and not usbstick"', a:arguments)
" endfunction
" function! g:DlcproRegtestShgProCmd(arguments)
" return s:DlcproRegtestCmd('dlc_pro_041355', 'elab-dlcpro2', '7', '1', 'TA-SHGpro', '-m "not usb and not usbstick"', a:arguments)
" endfunction
command -nargs=1 -complete=file DlcproRegtest call s:DlcproRegtest(g:DlcproRegtestCmd('<args>'))
command -nargs=1 -complete=file DlcproRegtestDlPro call s:DlcproRegtest(g:DlcproRegtestDlProCmd('<args>'))
command -nargs=1 -complete=file DlcproRegtestTaPro call s:DlcproRegtest(g:DlcproRegtestTaProCmd('<args>'))
command -nargs=1 -complete=file DlcproRegtestCtl call s:DlcproRegtest(g:DlcproRegtestCtlCmd('<args>'))
command -nargs=1 -complete=file DlcproRegtestDualDl call s:DlcproRegtest(g:DlcproRegtestDualDl1Cmd('<args>'))
command -nargs=1 -complete=file DlcproRegtestDualDl1 call s:DlcproRegtest(g:DlcproRegtestDualDl1Cmd('<args>'))
command -nargs=1 -complete=file DlcproRegtestShgPro call s:DlcproRegtest(g:DlcproRegtestShgProCmd('<args>'))
command -nargs=1 -complete=file DlcproRegtest call s:DlcproRegtest('<args>')
let g:DlcproRegtest_fast_restart = 1
let g:DlcproRegtest_marks = '"-m (no_crash_without_mc_fpga and not usb and not usbstick and not si and not si1 and not servo_control and not eom and not cavity and not cell_spectroscopy and not falc and not pfd and not smc)"'
"let g:DlcproRegtest_marks = ""
let g:DlcproRegtest_lasertype = "DLpro"
let g:DlcproRegtest_powerswitch_ip = ""
function! s:DlcproRegtestCmd(ip, powerswitch_ip, powerplug, laser_count, laser_type, opts, arguments)
if (a:ip == '')
let ip = g:DeviceIP
else
let ip = a:ip
endif
if (a:laser_type == '')
let laser_type = g:DlcproRegtest_lasertype
else
let laser_type = a:laser_type
endif
if (a:powerswitch_ip == '')
let powerswitch_ip = g:DlcproRegtest_powerswitch_ip
else
let powerswitch_ip = a:powerswitch_ip
endif
let archive_dir = g:ProjectBuildDir."/artifacts"
let license_builddir = s:ProjectBaseDir.'/build.license'
let licensetool = license_builddir."/dlcprolicense-tool/dlcprolicense-tool"
let $JENKINS_URL = g:jenkins_url
let test_cmd =
\s:ProjectSrcDir."/test/python-env/bin/python -u -m pytest ".
\"--showlocals --tb=long --verbose --cache-clear ".
\"-o junit_family=xunit1 ".
\"--junit-xml=regtest.".laser_type.".xml ".
\"--debug_build ".
\"--laser_count=".a:laser_count." ".
\"--laser1_type=".laser_type." ".
\"--log-file=regtest.".laser_type.".log ".
\"--target_ip=".ip." ".
\"--powerswitch_ip=".powerswitch_ip." ".
\"--powerswitch_passwd=nimda ".
\"--power_plug=".a:powerplug." ".
\"--power_plug_fan=8"." ".
\"--license_tool=".licensetool." ".
\"--license_keyfile=".s:ProjectSrcDir."/license/libdlcprolicense/rsa-private.key ".
\"--log-cli-level=INFO "
\"--log-file-level=DEBUG "
\""
if (g:DlcproRegtest_fast_restart == 1)
let test_cmd .= "--fast_restart "
endif
" hint: --collect-only
let test_cmd .= a:opts." ". g:DlcproRegtest_marks." ".a:arguments
let @+ = test_cmd
return test_cmd
endfunction
let g:DlcproRegtest_marks = 'usb, usbstick, si, si1, servo_control, eom, cavity, cell_spectroscopy, falc, pfd, smc'
function! s:DlcproRegtest(test_cmd)
execute "wa"
" Build license tool
let license_builddir = s:ProjectBaseDir.'/build.license'
let licensetool = license_builddir."/libdlcprolicense/dlcprolicense-tool"
let license_cmake = "cmake -DLICENSE_TOOL=1 -DCMAKE_BUILD_TYPE=Release ".s:ProjectSrcDir."/license"
let license_make = "make dlcprolicense-tool"
if !executable(licensetool)
call mkdir(license_builddir, "p")
call term_start(license_cmake, {'cwd' : license_builddir})
sleep 2
call term_start(license_make, {'cwd' : license_builddir})
sleep 5
let regtest_cmd = s:invoke
\.' -e'
\.' regtest'
\.' --device-ip='.g:DeviceIP
\.' --laser-type=DL-CBCpro'
let regtest_cmd .= ' --marks="'.g:DlcproRegtest_marks.'"'
if g:DlcproRegtest_fast_restart == 1
let regtest_cmd .= ' --fast-restart'
endif
if (a:test_cmd != "")
let regtest_cmd .= ' --tests="'.a:test_cmd.'"'
endif
" Build command
echom a:test_cmd
" Execute pytest
execute "terminal ++shell cd " s:ProjectSrcDir. "/test && " . a:test_cmd
" call term_start(a:test_cmd, {'cwd' : s:ProjectSrcDir."/test"})
echo regtest_cmd
execute "terminal ++shell " . regtest_cmd
endfunction
" ------