Jitterentropy TestU01 scenarios

Test the Jitterentropy VFS plugin against the TestU01 Alphabet and
Rabbit batteries.

Ref #48
This commit is contained in:
Emery Hemingway
2016-10-11 17:01:03 +02:00
committed by Norman Feske
parent 8b8491aaf1
commit 7a61552f8c
7 changed files with 165 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
set test_name "testu01_alphabet"
source ${genode_dir}/repos/world/run/jitterentropy_testu01.inc
run_genode_until "child \"${test_name}\" exited with exit value 0" 600

View File

@@ -0,0 +1,5 @@
set test_name "testu01_rabbit"
source ${genode_dir}/repos/world/run/jitterentropy_testu01.inc
run_genode_until "child \"${test_name}\" exited with exit value 0" 1200

View File

@@ -0,0 +1,72 @@
#
# \brief Jitterentropy TestU01 tests
# \author Emery Hemingway
# \date 2015-12-11
#
#
# Configuration variables
#
# $test_name
#
set build_components {
core init drivers/timer
lib/vfs/jitterentropy
}
lappend build_components test/$test_name
build $build_components
create_boot_directory
set config {
<config>
<parent-provides>
<service name="CAP"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="PD"/>
<service name="RAM"/>
<service name="RM"/>
<service name="ROM"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="}
append config $test_name
append config {">
<exit propagate="yes"/>
<resource name="RAM" quantum="1G"/>
<config file="/jitterentropy">
<libc stdout="/log" stderr="/log">
<vfs> <log/> <jitterentropy/> </vfs>
</libc>
</config>
</start>
</config>
}
install_config $config
# generic modules
set boot_modules {
core init timer
ld.lib.so libc.lib.so libm.lib.so
vfs_jitterentropy.lib.so
}
lappend boot_modules $test_name
build_boot_image $boot_modules
append qemu_args " -nographic"
# vi: set ft=tcl :

View File

@@ -0,0 +1,36 @@
#include <base/attached_rom_dataspace.h>
#include <base/component.h>
#include <base/log.h>
extern "C" {
#include "bbattery.h"
}
void Component::construct(Genode::Env &env)
{
using namespace Genode;
Attached_rom_dataspace config_rom(env, "config");
Xml_node const config = config_rom.xml();
enum {
MIN_NBITS = 500,
DEFAULT_NBITS = 1U << 20
};
unsigned nbits = max((unsigned)MIN_NBITS,
config.attribute_value("nbits", (unsigned)DEFAULT_NBITS));
String<128> file;
try {
config.attribute("file").value(&file);
} catch (...) {
error("'file' not declared in config");
env.parent().exit(~0);
return;
}
bbattery_AlphabitFile((char *)file.string(), nbits);
env.parent().exit(0);
}

View File

@@ -0,0 +1,3 @@
TARGET = testu01_alphabet
LIBS += testu01 libc libm
SRC_CC = main.cc

View File

@@ -0,0 +1,41 @@
#include <base/attached_rom_dataspace.h>
#include <base/component.h>
#include <base/log.h>
extern "C" {
#include "gdef.h"
#include "swrite.h"
#include "bbattery.h"
}
/* This is a big one */
Genode::size_t Component::stack_size() { return 64*1024*sizeof(Genode::addr_t); }
void Component::construct(Genode::Env &env)
{
using namespace Genode;
Attached_rom_dataspace config_rom(env, "config");
Xml_node const config = config_rom.xml();
enum {
MIN_NBITS = 500,
DEFAULT_NBITS = 1U << 20
};
unsigned nbits = max((unsigned)MIN_NBITS,
config.attribute_value("nbits", (unsigned)DEFAULT_NBITS));
String<128> file;
try {
config.attribute("file").value(&file);
} catch (...) {
error("'file' not declared in config");
env.parent().exit(~0);
return;
}
bbattery_RabbitFile((char *)file.string(), nbits);
env.parent().exit(0);
}

View File

@@ -0,0 +1,3 @@
TARGET = testu01_rabbit
LIBS += testu01 libc libm
SRC_CC = main.cc