Addressing System Unit Testing Plan

Addressing System Unit Testing Plan
SchemeStation documentation

1 Purpose

This document describes the unit testing of the SCHEMESTATION addressing system. The purpose of the unit testing is to show that the data structures held by the addressing system remain consistent in all conditions, the addressing system is capable of saving and searching addresses, and that it remains stable in erraneous conditions. The requirements for the addressing system are specified in Addressing module specification.

2 Module testing

A special test program will be set up to test the module inside out. It will perform all operations: adding, setting, deleting and searching entries, initializing and shutting down the system, saving and reading the system from the disk. Moreover, the addressing system module will be flooded with both erraneous requests and inreasonably large amounts of entry additions.

2.1 Per function testing

Each function will be separately tested considering the following aspects:

2.2 Other tests

The addressing unit interface is tested as follows:

2.3 The test program

A separate testing program will be written that mainly does the testing. It consists of the following stages:

2.3.1 Addressing system initilization

The addressing system is initialized using the addr_initaddrsystem-function. The result should be a consistent AddressSystem struct with the pointers initialized. This can be verified using gdb.

2.3.2 Generating specifiers

Adequate number of actor specifiers is generated using addr_generatespecifier. The agent specifiers are dumped to screen using a suitable hexdump-function, and their uniqueness is verified using eg. uniq(1).

2.3.3 Adding entries

A vast number of random agent entries are added to the system using addr_addentry. The number has to be big enough to initiate hash table resizing. The consistence is verified using addr_dumpaddrsystem. The consistence of the system is ensured after the address table rehashing has occurred. In the stress test phase, the amount of address is raised to the limit - the purpose is to ensure that adding several tens of thousands of agents can be done.

2.3.4 Comparing addresses and specifiers

Some random addresses (of each type - local, remote and special) are generated, and they are compared to each other. It is ensured using addr_dumpaddr, that if and only if the addresses/specifiers are identical, a true value is returned.

2.3.5 Searching entries

Entries are sought using addr_entrybyspec and addr_entrybyaddr. It is manually verified (using addr_dumpaddrsystem) that the results are consistent.

2.3.6 Saving the system and reading it from the disk

The system is saved to disk using addr_savetodisk (which calls addr_saveentry and mess_savemessage). The system is then deleted and reread from the disk using addr_readfromdisk (which calls addr_readentry and mess_readmessage). The consistence of the system before and after the disk operation is ensured using addr_dumpaddrsystem.

2.3.7 Removing entries

The added entries are deleted using addr_removentry, and it is ensured that no memory allocation bug occur, and no entries remain in the system.

2.4 Shutting the system down

The addressing system is shut down using addr_shutdownaddrsystem. It is ensured that all entries will be deleted and that no memory leaks occur (using Efence-malloc library).

3 The results

The addressing system testing included a 1-3 call test for each function, and a stress test, whose purpose was to unveil the memory leaks and defects in performance. The plan for addressing system testing [SCHEMESTATION Addressing System Unit Testing Plan] was followed quite closely.

In stress test phase, we added and removed 50 000 addressing entries in the system twice.

The stress test along with the memory allocation library written espacially for finding memory leaks in SCHEMESTATION source, was enough to reveal few memory minor leaks in the system. One of these could have had some notable influence in the reals system after a long period of usage.

All test concerning the semantics of the functions were succesfully passed.

There was a more serious bug that was not found in the per module testing; fortunately it was found in intergration testing. The bug cause malfunction of the entire system under certain conditions. The bug has now been terminated by mr. Antti Huima.

3.1 Summary

subject status result comments
Do the functions implement the semantics defined in the spec? done passed An uninitialized variable detected - this might have caused problems in some situations
Do the functions survive calls with illegal arguments?partly done - -
Stress test - enormeous number of addressing entries donepassedA little memory leak found and fixed. Performance seems satisfactory

3.2 Functions

name status result comments
addr_addresstoasc done success
addr_deliver_messagesdone success
addr_dumpentry done success
addr_entriesbyaddrdone success
addr_entrybyspec done success
addr_freeentrydone success
addr_hashvaluedone success
addr_hexdump done success
addr_push_message done success
addr_readentry done success
addr_resizehash done success
addr_spechashvaluedone success
addr_spectoasc done success
addr_writeentry done success