Adding a New Partest Option?

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]                       ^

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?

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.

Thanks, that was the key point; submitted the point, with amplification, as a PR (adriaanm’s note re PartestUtil.scala & sbt build by FlashSheridan · Pull Request #8386 · scala/scala · GitHub) to CONTRIBUTING.md. The tests are running now against the selected compiler, though my changes need considerable cleanup before submitting them.