Tag Archives: testing

Sink Your Fangs

Check out snakebite. Some folks associated with the Python programming language put together a farm of computers that all Python committers have access to so that they can code and test. They put together an impressive network, though the PowerPC architecture is suspiciously unrepresented in any incarnation that I can find. They received some notable corporate sponsorship too, according to the announcement email on python-committers.

Wouldn’t it be neat to set up something like this for FFmpeg folks? Actually, I tend to think our first and foremost concern would be to get a community-accessible PowerPC machine for debugging various woes on that platform. My PowerPC-based Mac Mini is overcommitted as it is. I happen to be personally familiar with at least one large corporation that has an unbelievable pile of PowerPC-based Macs in its basement (along with loads of other computers), waiting to recycled one day. Regrettably, they have no policy for repurposing the computers for non-corporate functions.

And I don’t want to hear anything about how hard it would be to debug problems in a multimedia program on a remote computer halfway around the world while only interacting via terminal. I did a significant amount of debugging and performance profiling of FFmpeg’s VP3 decoder once upon a time under those very circumstances. My trick, when I had to view the results of a decode operation, were to write the video frames to individual JPEG files. Then, I would run webfs to serve those JPEGs via HTTP to the localhost IP address and tunnel it back to my own machine via SSH to view in a local web browser.

Implementing The RPC Idea

About that RPC-based distributed test staging idea I brainstormed yesterday, I’ll have you know that I successfully implemented the thing today. I used the fraps-v4 test spec for verification because it is known to work correctly right now, and because it only has 7 lines of stdout text. This is what the script looks like in action:

$ ./rpc-dist-test.py "FFMPEG -i 
  SAMPLES_PATH/fraps/WoW_2006-11-03_14-58-17-19-nosound-partial.avi 
  -f framecrc -" 
asking for results from 12 configurations...
testing config 0: Linux / x86_64 / gcc 4.0.4
testing config 1: Linux / x86_64 / gcc 4.1.2
testing config 2: Linux / x86_64 / gcc 4.2.4
testing config 3: Linux / x86_64 / gcc 4.3.2
testing config 4: Linux / x86_64 / gcc svn
testing config 5: Linux / PPC / gcc 4.0.4
testing config 6: Linux / PPC / gcc 4.1.2
testing config 7: Linux / PPC / gcc 4.2.4
testing config 8: Linux / PPC / gcc 4.3.2
testing config 9: Linux / PPC / gcc svn
testing config 10: Mac OS X / x86_32 / gcc 4.0.1
testing config 11: Mac OS X / x86_64 / gcc 4.0.1

1 configuration(s) failed
  configuration Mac OS X / x86_32 / gcc 4.0.1 returned status 133

There was 1 unique stdout blob collected
all successful configurations agreed on this stdout blob:
0, 0, 491520, 0x68ff12c0
0, 3000, 491520, 0x22d36f0d
0, 6000, 491520, 0xce6f877d
0, 9000, 491520, 0x85d6744c
0, 12000, 491520, 0x1aa85794
0, 15000, 491520, 0x528d1274
0, 18000, 491520, 0x357ec61c

A few notes about the foregoing: Continue reading

RPC-Based Distributed Test Staging

FATE needs to have more tests. A lot more tests. It has a little over 200 test specs right now and that only covers a fraction of FFmpeg‘s total functionality, not nearly enough to establish confidence for an FFmpeg release.

Here’s the big problem: It’s a really tedious process to initiate a new test into the suite. Sure, I sometimes write special scripts that do the busywork for me for a large set of known conformance samples. But my biggest record for entering tests manually seems to be a whopping 11 test specs in one evening.

The manual process works something like this: Given a sample that I think is suitable to test a certain code path in FFmpeg, place the sample in a shared location where my various FATE installations can reach it. Then, get the recent FFmpeg source from SVN (in repositories separate from where FATE keeps its code). Compile the source on each platform, using whichever compiler I feel like for each. On a platform that has SDL installed, run the sample through ffplay to verify that the data at least sort of looks and sounds correct (e.g., nothing obviously wrong like swapped color planes or static for audio). Then, run a command which will output CRC data per the ‘-f framecrc’ output target. Visually compare the CRC data (at least the first and last lines) to verify that the output is consistent across a few platforms (say, PPC, x86_32, and x86_64). Then go through the process of writing up the test in my FATE administration panel.

I’m constantly thinking about ways to improve processes, particularly processes as tortuously tedious as this. The process has already seen a good deal of improvement (before making a basic web admin form, I had to add and edit the test specs from a MySQL console). I intend to address the inadequacy of the basic web form at a later date when I hopefully revise the entire web presentation. What I want to do in the shorter term is address the pain of verifying consistent output across platforms.

I got the idea that it would be nice to be able to ask a FATE installation — remotely — to run a test and pass back the framecrc output. This way, I could have one computer ask several others to run a test and quickly determine if all the machines agree on the output. But would I have to write a special server to make this possible? Sounds like a moderate amount of work. Wait, what about just SSH’ing into a remote machine and running the test? Okay, but would I still have to recompile the source code to make sure the FFmpeg binary exists? No, if these are FATE installations, they are constantly building FFmpeg day and night. Just be sure to save off a copy of the ‘ffmpeg’ binary and its shared libraries in a safe place. But where would such saving take place? Should I implement a post processing facility in fate-script.py to be executed after a build/test cycle? That shouldn’t be necessary– just copy off the relevant binaries at the end of a successful build mega-command.

So the pitch is to modify all of my FATE configurations to copy ‘ffmpeg’ and 4 .so files to a safe place. As a bonus, I can store the latest builds for all configurations; e.g., my x86_32 installation will have 8 different copies, one for each of the supported compilers. The next piece of the plan is Python script! Create a configuration file that is itself a Python file that has a data structure which maps out all the configurations, the machines they live on, the directory where their latest binaries live, and where they can find the shared samples. The main Python script takes an argument in the form of (with quotes) “FFMPEG_BIN -i SAMPLES_PATH/sample.avi -an -t 3 -f framecrc -“, iterates through the configurations, builds SSH remote calls by substituting the right paths into the command line, and processes the returned output.

Simple! Well, one part that I’m not sure about is exactly how to parse the output. I think I might use the whole of the returned stdout string as a dictionary key that maps to an array of configurations. If the dictionary winds up with only one key in the end, that means that all the configurations agreed on the output; add a new test spec!

Thanks for sitting through another of my brainstorming sessions.

See also:

What Platform Would You Like To Test?

What platforms should FATE test? So far, it is testing both x86_32 and x86_64 under Linux and Mac OS X, and PowerPC under Linux. These are the first and foremost platforms I care about, and have access to.

What other platforms would people like to see tested through FATE? Windows? *BSD? Solaris? Linux running on exotic bits of hardware? Game consoles? Well, I have great news: After many months of occasional work on the FATE infrastructure, I am confident that the system is in a shape where other people can run the core FATE script and submit results back to the main server.

I have released the first public version of the script at the core of FATE: fate-script.py. Anyone can run it locally on their own platforms, but it requires a few credentials (assigned by me) in order to submit results to the server.

Feedback is very welcome, as are offers to run FATE continuously on other platforms. Also, I would love to know how to properly version something with git. All I can say is that the currently posted version of fate-script.py is version 67eac48073a24deece52cb28fbb25c14858b6c23.