A laser-based system for a fast and accurate measurement of gain and linearity of photomultipliers