Run simulator tests rotated

I'm trying to write a .sh script to automatically run UI tests for all devices and device layouts (portrait/landscape). Is there a flag I can use to rotate the device using the command line?


If not, is the best way to just extract my current tests into functions and have two tests that set the layout prior to calling the function?