Testing a project using the test files that came with the distribution


(Benjamin Esham) #1

I’m trying to package my chrome-export project. The project ships with a set of input files and a set of expected-output files that can be used to verify that the scripts are behaving correctly.

How can I make use of these files when a user runs brew test? It seems like the test stanza in the formula only has access to the files that were installed by the formula; it doesn’t have access to any of the other files that were included in the tarball. Am I correct about that? And if so, what’s the preferred way to get access to the test files?

(I guess I could install them to the share directory, but then they’d be using 120 kiB on everyone’s system just on the off chance that someone wanted to run brew test. I could redownload the entire tarball in the test stanza, but that feels wasteful.)


(Mike McQuaid) #2

Yeh, just install them. I really wouldn’t care about 120kiB, it really doesn’t matter. Note (not for you but anyone else reading this): don’t install and run unit tests but ensure you’re running a binary the user would run or you’re not really testing that packaging and Homebrew installation was done correctly but just compilation.


(Benjamin Esham) #3

Okay, thank you! I actually got the test files down to 3.6 kiB by compressing them so I don’t feel bad about keeping them around all the time.