rom_blk test: abort if test fails

Instead of printing the success message at the end of the test,
abort as soon as two blocks differ.

Ref #966
This commit is contained in:
Stefan Kalkowski 2013-11-29 15:51:17 +01:00 committed by Norman Feske
parent 66d499e416
commit adc63ef2a6

View File

@ -17,6 +17,7 @@
#include <base/allocator_avl.h>
#include <base/printf.h>
#include <base/sleep.h>
#include <base/exception.h>
#include <base/thread.h>
#include <os/config.h>
#include <block_session/connection.h>
@ -31,6 +32,8 @@ class Comparer : public Genode::Thread<8192>
Genode::Rom_connection _rom;
Genode::addr_t _addr;
class Block_file_differ : Genode::Exception {};
public:
enum {
@ -87,8 +90,10 @@ class Comparer : public Genode::Thread<8192>
if (blk_src[j*blk_size+k] != rom_src[j*blk_size+k])
differ = true;
}
if (differ)
if (differ) {
PWRN("block %zx differs!", i);
throw Block_file_differ();
}
source->release_packet(p);
} catch (Block::Session::Tx::Source::Packet_alloc_failed) {
PERR("Mmh, strange we run out of packets");