mirror of https://github.com/sbt/sbt.git
test: Add citest2 directory for sbt 2.x integration tests
This commit is contained in:
parent
96340302ff
commit
e50e8359e8
|
|
@ -0,0 +1,31 @@
|
|||
@echo on
|
||||
|
||||
cd "%~dp0"
|
||||
|
||||
mkdir freshly-baked
|
||||
unzip ..\target\universal\sbt.zip -d freshly-baked
|
||||
|
||||
SETLOCAL
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" about
|
||||
|
||||
SET JAVA_HOME=C:\jdk11
|
||||
SET PATH=C:\jdk11\bin;%PATH%
|
||||
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true about
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true about 1> output.txt 2> err.txt
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true check
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true --numeric-version > numericVersion.txt
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true checkNumericVersion
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true --script-version > scriptVersion.txt
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true checkScriptVersion
|
||||
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true --version > version.txt
|
||||
"freshly-baked\sbt\bin\sbt" -Dsbt.no.format=true checkVersion
|
||||
|
||||
ENDLOCAL
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
# exit when something fails
|
||||
set -e
|
||||
|
||||
## https://github.com/travis-ci/travis-ci/issues/8408
|
||||
unset _JAVA_OPTIONS
|
||||
unset SBT_OPTS
|
||||
|
||||
java -version
|
||||
## end of Java switching
|
||||
|
||||
rm -rf freshly-baked
|
||||
mkdir -p freshly-baked
|
||||
unzip ../target/universal/sbt.zip -d ./freshly-baked
|
||||
|
||||
./freshly-baked/sbt/bin/sbt -Dsbt.no.format=true about
|
||||
./freshly-baked/sbt/bin/sbt -Dsbt.no.format=true about 1> output.txt 2> err.txt
|
||||
./freshly-baked/sbt/bin/sbt check
|
||||
|
||||
./freshly-baked/sbt/bin/sbt about run -v
|
||||
|
||||
./freshly-baked/sbt/bin/sbt about run
|
||||
|
||||
fail() {
|
||||
echo "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# env HOME=./target/home1 ./freshly-baked/sbt/bin/sbt about
|
||||
# test -d ./target/home1/.sbt/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home1/.sbt"
|
||||
|
||||
# env HOME=./target/home2 ./freshly-baked/sbt/bin/sbt -sbt-dir ./target/home2/alternate-sbt about
|
||||
# test -d ./target/home2/alternate-sbt/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home2/alternate-sbt"
|
||||
|
||||
# env HOME=./target/home3 ./freshly-baked/sbt/bin/sbt -J-Dsbt.preloaded=./target/home3/alternate-preloaded about
|
||||
# test -d ./target/home3/alternate-preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home3/alternate-preloaded"
|
||||
|
||||
# env HOME=./target/home4 ./freshly-baked/sbt/bin/sbt -J-Dsbt.global.base=./target/home4/global-base about
|
||||
# test -d ./target/home4/global-base/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home4/global-base"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#-XX:+CMSClassUnloadingEnabled
|
||||
#-XX:ReservedCodeCacheSize=192m
|
||||
#-Duser.timezone=GMT
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
lazy val check = taskKey[Unit]("")
|
||||
lazy val checkNumericVersion = taskKey[Unit]("")
|
||||
lazy val checkScriptVersion = taskKey[Unit]("")
|
||||
lazy val checkVersion = taskKey[Unit]("")
|
||||
|
||||
// 1.3.0, 1.3.0-M4
|
||||
lazy val versionRegEx = "\\d(\\.\\d+){2}(-\\w+)?"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
scalaVersion := "2.12.4",
|
||||
name := "Hello",
|
||||
check := {
|
||||
val xs = IO.readLines(file("output.txt")).toVector
|
||||
|
||||
println(xs)
|
||||
|
||||
assert(xs(0) startsWith "[info] Loading project definition")
|
||||
assert(xs(1) startsWith "[info] Loading settings from build.sbt")
|
||||
assert(xs(2) startsWith "[info] Set current project to Hello")
|
||||
assert(xs(3) startsWith "[info] This is sbt")
|
||||
assert(xs(4) startsWith "[info] The current project")
|
||||
assert(xs(5) startsWith "[info] The current project is built against Scala 2.12.4")
|
||||
|
||||
val ys = IO.readLines(file("err.txt")).toVector.distinct
|
||||
|
||||
assert(ys.size == 1, s"ys has more than one item: $ys")
|
||||
assert(ys(0) startsWith "Java HotSpot(TM) 64-Bit Server VM warning")
|
||||
},
|
||||
checkNumericVersion := {
|
||||
val xs = IO.readLines(file("numericVersion.txt")).toVector
|
||||
val expectedVersion = "^"+versionRegEx+"$"
|
||||
|
||||
assert(xs(0).matches(expectedVersion))
|
||||
},
|
||||
checkScriptVersion := {
|
||||
val xs = IO.readLines(file("scriptVersion.txt")).toVector
|
||||
val expectedVersion = "^"+versionRegEx+"$"
|
||||
|
||||
assert(xs(0).matches(expectedVersion))
|
||||
},
|
||||
checkVersion := {
|
||||
val out = IO.readLines(file("version.txt")).toVector.mkString("\n")
|
||||
|
||||
val expectedVersion =
|
||||
s"""|(?m)^sbt version in this project: $versionRegEx
|
||||
|sbt script version: $versionRegEx$$
|
||||
|""".stripMargin.trim.replace("\n", "\\n")
|
||||
|
||||
assert(out.matches(expectedVersion))
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
@echo on
|
||||
|
||||
SETLOCAL
|
||||
|
||||
SET JAVA_HOME=%JAVA_HOME_25_X64%
|
||||
SET PATH=%JAVA_HOME_25_X64%\bin;%PATH%
|
||||
SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8
|
||||
|
||||
SET BASE_DIR=%CD%
|
||||
SET SCRIPT_DIR=%~dp0
|
||||
|
||||
CD %SCRIPT_DIR%
|
||||
"%BASE_DIR%\freshly-baked\sbt\bin\sbt" about 1> output.txt 2> err.txt
|
||||
"%BASE_DIR%\freshly-baked\sbt\bin\sbt" check
|
||||
CD %BASE_DIR%
|
||||
|
||||
ENDLOCAL
|
||||
|
||||
IF %errorlevel% NEQ 0 EXIT /b %errorlevel%
|
||||
Loading…
Reference in New Issue