1
0
Fork 0

Migrate tests/setup.bat to PowerShell

Removed set / ping hacks
This commit is contained in:
wangqr 2020-03-29 22:25:15 -04:00
parent 62708e8e5c
commit 5318838b93
2 changed files with 43 additions and 48 deletions

View File

@ -1,48 +1,2 @@
cd %1
icacls data /grant:r %USERNAME%:F /T
rd /s /q data
mkdir data
copy nul data\file
mkdir data\dir
copy nul data\file_access_denied
icacls data\file_access_denied /deny %USERNAME%:F
copy nul data\file_read_only
icacls data\file_read_only /deny %USERNAME%:W
mkdir data\dir_access_denied
icacls data\dir_access_denied /deny %USERNAME%:F
mkdir data\dir_read_only
icacls data\dir_read_only /deny %USERNAME%:W
echo {"Video" : ["Entry One", "Entry Two"]} > data/mru_ok.json
echo {"Video" : [1, 3]} > data/mru_invalid.json
< nul set /p ="1234567890" > data\ten_bytes
copy nul data\touch_mod_time
mkdir data\dir_iterator
copy nul data\dir_iterator\1.a
copy nul data\dir_iterator\2.a
copy nul data\dir_iterator\1.b
copy nul data\dir_iterator\2.b
mkdir data\options
xcopy "%~dp0\options" data\options
mkdir data\vfr
mkdir data\vfr\in
mkdir data\vfr\out
xcopy "%~dp0\vfr" data\vfr\in
mkdir data\keyframe
xcopy "%~dp0\keyframe" data\keyframe
ping -n 2 127.0.0.1 > nul
@echo off
powershell.exe -NoProfile -ExecutionPolicy Bypass "& {& '%~dp0setup.ps1' %*}"

41
tests/setup.ps1 Normal file
View File

@ -0,0 +1,41 @@
icacls data /grant:r "${env:UserName}:F" /T
Remove-Item -Path "data" -Recurse
New-Item -Path "data" -ItemType "directory"
New-Item -Path "data\file" -ItemType "file"
New-Item -Path "data\dir" -ItemType "directory"
New-Item -Path "data\file_access_denied" -ItemType "file"
icacls data\file_access_denied /deny "${env:UserName}:F"
New-Item -Path "data\file_read_only" -ItemType "file"
icacls data\file_read_only /deny "${env:UserName}:W"
New-Item -Path "data\dir_access_denied" -ItemType "directory"
icacls data\dir_access_denied /deny "${env:UserName}:F"
New-Item -Path "data\dir_read_only" -ItemType "directory"
icacls data\dir_read_only /deny "${env:UserName}:W"
New-Item -Path "data\mru_ok.json" -ItemType "file" -Value '{"Video" : ["Entry One", "Entry Two"]}'
New-Item -Path "data\mru_invalid.json" -ItemType "file" -Value '{"Video" : [1, 3]}'
New-Item -Path "data\ten_bytes" -ItemType "file" -Value "1234567890"
New-Item -Path "data\touch_mod_time" -ItemType "file"
(Get-ChildItem -Path "data\touch_mod_time").LastWriteTime.AddSeconds(-1)
New-Item -Path "data\dir_iterator" -ItemType "directory"
New-Item -Path "data\dir_iterator\1.a" -ItemType "file"
New-Item -Path "data\dir_iterator\2.a" -ItemType "file"
New-Item -Path "data\dir_iterator\1.b" -ItemType "file"
New-Item -Path "data\dir_iterator\2.b" -ItemType "file"
Copy-Item -Path "${PSScriptRoot}\options" -Destination "data\options" -Recurse
New-Item -Path "data\vfr" -ItemType "directory"
Copy-Item -Path "${PSScriptRoot}\vfr" -Destination "data\vfr\in" -Recurse
New-Item -Path "data\vfr\out" -ItemType "directory"
Copy-Item -Path "${PSScriptRoot}\keyframe" -Destination "data\keyframe" -Recurse