How is horsepower measured for aviation piston engines?
Like anything else a Dynamometer is used except the engine is bolted directly to it (most likely on a test bench). In a car a rolling road is simply a way to couple the tires to the dyno without having to have any custom fittings. For what its worth cars lose a bit of horse power in the transmission/drive shaft/differential so shaft horse power and wheel horsepower are not always the same. However in a plane the prop is bolted more or less to the end of the crank (with the exception of some planes with stepper gear boxes). In any case shaft horsepower on a plane engine is more or less whats available at the prop.  

Here is a lycoming engine on a dyno



(source)