Factory test

We're doing the factory runs in batches, since there are multiple configurations of boards. Every board that leaves the factory will start out life as a "bare board", and will have features added to it later on.

The factory test itself serves to do two things: Test the board, and load the board's firmware image. Since the firmware is so large and we have multiple cores, the task of writing the firmware is done in the background throughout the test as an "MMCTest" while some longer-term tests are run.

The factory test is very foreign to programmers who are used to a "test suite" that exhaustively tests a software package. Unlike in software, when building a machine like this it is safe to assume that certain parts are pre-tested and reliable. For example, we won't do an exhaustive memory test to verify reliability because, as anyone who's had a memory module fail, when system RAM is unreliable, you find out very quickly.

Instead, we simply make sure that the board was assembled correctly. To do this, we check various strings, probe various modules, and run some kernel tests that one normally does not use. For example, we test one of the USB host ports at the same time as the USB OTG port by connecting one to the other, configuring the loopback port as g_zero, and loading the usbtest.ko module. This provides a thorough signal test and verifies that the tricky-to-solder OTG port has been placed correctly.

Another example of a simple test is the accelerometer test. We simply read values out from /sys/bus/iio/ and make sure they are within acceptable ranges. If the files don't exist at all, then the chip probably wasn't placed properly.

One of the more unusual tests is the audio test. In the past, we've had the test finish by playing an obnoxious sound. This time, because writing a disk image can take 5-10 minutes, we'll be running five devices at once. If they all finish at the same time, that will create an awful lot of noise. Instead, what I've chosen to do is load several sound files in a pentatonic scale and play a few of them at random. This creates a pleasant windchime-like effect, and because they're all in the same key if multiple boards finish at the same time it won't sound terrible.

Things start rolling off the production line soon. Exciting times!