Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test an emulator

How should we organize unit tests and system tests for a program that emulates a hardware (that is like vmWare)?

Background:

We have for many years managed a computer from the 1980s and associated peripheral equipments and software. The system is critical to our customers and they do not want to replace it. We have therefore chosen to develop emulators for some of the hardware. The problem is that it is poorly documented in many thousands of pages of typewriter written text. It is therefore try and error-development.

The problem:

We currently have no unit tests of the emulator and the system tests are very add-hock. It is difficult to test whether a complex OS works in all aspects by typing in the text terminal and simulate data input from external systems. The only way we're testing right now is to add a large input pressure from external systems (via X.25) and automate some heavy operations regularly. But you miss so much then.

like image 273
magol Avatar asked May 10 '12 14:05

magol


People also ask

How do I test an emulator?

Record a test using the mobile browser emulator: Start test recording. Select a mobile browser profile from the Run App | Virtual Browser drop-down list on the Recording toolbar. TestComplete will launch the emulator with the selected profile.

What is an emulation test?

Emulation means basically a complete imitation of the real thing. It just operates in a virtual environment instead of the real world. An emulator in mobile testing is a virtual device. It allows you to test your app by emulating a real device. A device emulator mimics the hardware or OS of the device.

What is emulator and simulator in testing?

Key Difference between Emulator and SimulatorAn emulator comes as a complete re-implementation of the original software, whereas A simulator is just a partial re-implementation of the original software. Both Emulators and Simulators are virtual devices.

What's the difference between an emulator and a simulator?

A simulator is designed to create an environment that contains all of the software variables and configurations that will exist in an app's actual production environment. In contrast, an emulator attempts to mimic all of the hardware features of a production environment and software features.


1 Answers

I used to work for a company doing something comparable. To test our system (which was actually a dynamic binary translator, not an emulator) we wrote a testing framework which would run the same commands natively and translated, then compare the results. We started doing this with userspace programs, but as we developed more sophisticated products we used the same techniques to automate testing of emulated hardware. Roughly speaking, you want to write some programs which access this hardware and do stuff to it, dumping all the output to the terminal or a log somewhere. Then run these programs on both sides (real and emulated), and compare the output. Depending on how exact your emulation is intended to be, you might need to some scripting to ignore certain parts of the output when diffing - addresses, hostnames, that sort of thing.

The other thing to watch out for when emulating hardware is state changes: a particular command might give the same output on both sides, but might change internal state in different ways. This can be tough to anticipate, but in general you need to identify internal state likely to be affected and dump it out along with output for each command.

Before we got bought we started working on something even cleverer, using kernel tracing tools to monitor OS/hardware state step-by-step as we ran our tests, then comparing the series of steps between native and translated runs. This was never fully developed, but looked very promising.

Sadly all this stuff was internal and closed-source, so I can't point you to anything you can run and play with, but the idea is very sound - we had thousands of automated tests like this running on every build of our translators with very satisfactory results.

Edit: The more I think about this problem the more keen I am to have a whack at it. I don't suppose your project is open-source, but if it is I'd love to participate. Feel free to contact me if that's a possibility.

like image 135
jimw Avatar answered Sep 23 '22 09:09

jimw