Adding a New Partest Option?

#1

I’d like to add a new option, --compilerpath to Partest (see Using Partest with a different compiler? for our motivation). I’ve added a line in scala/src/partest/scala/tools/partest/nest/RunnerSpec.scala modelled on the line for optSourcePath:

val optCompilerPath = "compilerpath" / "set (absolute) path to compiler under test (ex.: --compilerpath /usr/local/bin/scalac)" --|

I also added handling of "--compilerpath", modelled on grepOption to partestParser in PartestUtil.scala, but that file does not seem to get compiled, and I’m not sure what the required effects are.

The new option shows up in partest --help, and suiteRunner.config.optCompilerPath is defined (though empty) in DirectCompiler.scala; but partest --compilerpath /usr/local/bin/scalac gets the same error as a completely undefined option:

sbt:root> partest --compilerpath /usr/local/bin/scalac
[error] Expected non-whitespace character
[error] partest --compilerpath /usr/local/bin/scalac
[error]                       ^
#2

PartestUtil.scala is part of scala’s sbt build.

Wild guess: did you also add your new rule to val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep | ScalacOptsParser?

#3

Wild guess: did you also add your new rule to val P = oneOf(knownUnaryOptions.map(x => token(x))) | SrcPath | TestPathParser | Grep | ScalacOptsParser ?

Yes, both by adding it to knownUnaryOptions (which was simple but wouldn’t have allowed specifying an argument), and then (with considerably less confidence) by creating and adding a val to the disjunction in the assignment to P. Both had the same result, an unrecognized option.