diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..74842dd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +* +!wastebasket.test* + diff --git a/test.ps1 b/test.ps1 new file mode 100644 index 0000000..0bbf210 --- /dev/null +++ b/test.ps1 @@ -0,0 +1,9 @@ +# remove preexisting test binaries from other systems to keep build context small +Remove-Item wastebasket.test* + +# read the first arg or default to "windows" +$os = $args[0] ?? "windows" +$env:GOOS=$os; go test -c . +$env:DOCKER_CONTEXT="desktop-$os"; docker build -t temp_test -f ".\test_$os.Dockerfile" . +docker image rm temp_test + diff --git a/test_linux.Dockerfile b/test_linux.Dockerfile new file mode 100644 index 0000000..4505044 --- /dev/null +++ b/test_linux.Dockerfile @@ -0,0 +1,8 @@ +# nanoserver doesn't have a shell, so we can't run the test, as we require +# shell systemcalls such as SHFileOperationW. +FROM docker.io/debian:trixie-slim + +WORKDIR /test +copy wastebasket.test ./test +RUN ./test + diff --git a/test_windows.Dockerfile b/test_windows.Dockerfile new file mode 100644 index 0000000..4dda6ed --- /dev/null +++ b/test_windows.Dockerfile @@ -0,0 +1,8 @@ +# nanoserver doesn't have a shell, so we can't run the test, as we require +# shell systemcalls such as SHFileOperationW. +FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 + +WORKDIR /test +copy wastebasket.test.exe ./test.exe +RUN test.exe +