"test_remote_delete",
"test_remote_revoke",
"testerror",
- "yield_test" ] ]
+ "yield_test",
+ "skb_cap_storage" ] ]
tests_x86 = [ "/sbin/" ++ f | f <- [
"tests/luatest",
Out "root" image,
NoDep BuildTree "root" "/",
Str physBase ] ++
- [ (Dep BuildTree "armv7" m) | m <- modules ] ++
+ [ (Dep BuildTree "armv7" m) | m <- modules ] ++
[ (Dep BuildTree "" m) | m <- modules_generic ] ),
Rule ([ Str Config.arm_objcopy,
"Xeon Phi build with benchmarks and test suites",
platform "QEMU" [ "armv8" ]
- ([ ("armv8", "/sbin/cpu_a57v") ]
+ ([ ("armv8", "/sbin/cpu_a57v") ]
++
[ ("armv8", f) | f <- armv8_modules ]
++
"root" ("/platforms/x86/menu.lst." ++ p)
| p <- [ "x86_64", "k1om" ] ],
-
+
boot "gem5_armv7_vexpressemm" [ "armv7" ] [
In SrcTree "tools" "/tools/arm_gem5/boot_gem5.sh",
Str "VExpress_EMM",
--- /dev/null
+##########################################################################
+# Copyright (c) 2011, ETH Zurich.
+# All rights reserved.
+#
+# This file is distributed under the terms in the attached LICENSE file.
+# If you do not find this file, copies can be found by writing to:
+# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
+##########################################################################
+
+import re
+import tests
+from common import TestCommon
+from results import PassFailResult
+
+@tests.add_test
+class SkbCapTest(TestCommon):
+ '''Test capability storage in SKB'''
+ name = "skb_cap_test"
+
+ def get_modules(self, build, machine):
+ modules = super(SkbCapTest, self).get_modules(build, machine)
+ modules.add_module("skb_cap_storage")
+ return modules
+
+ def get_finish_string(self):
+ return "SUCCESS"
+
+ def process_data(self, testdir, rawiter):
+ # the test passed iff the last line is the finish string
+ lastline = ''
+ for line in rawiter:
+ lastline = line
+ passed = lastline.startswith(self.get_finish_string())
+ return PassFailResult(passed)
--- /dev/null
+#include <stdio.h>
+#include <stdint.h>
+#include <assert.h>
+#include <string.h>
+
+#include <barrelfish/barrelfish.h>
+#include <octopus/octopus.h>
+#include <octopus/capability_storage.h>
+#include <skb/skb.h>
+
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
+
+int main(int argc, char** argv)
+{
+ errval_t err = oct_init();
+ assert(err_is_ok(err));
+ err = skb_client_connect();
+ assert(err_is_ok(err));
+
+ // Old things should work as before
+ err = skb_add_fact("y(x(%s, %d)).", "test", 1);
+ if (err_is_fail(err)) {
+ USER_PANIC_ERR(err, "call failed.");
+ }
+ err = skb_execute_query("y(L),write(L).");
+ if (err_is_fail(err)) {
+ USER_PANIC_ERR(err, "call failed.");
+ }
+
+ char retbuf[8] = {'\0'};
+ skb_read_output("x(%s, 1)", retbuf);
+ if (strcmp(retbuf, "test,") != 0) {
+ USER_PANIC("Failed to store knowledge in SKB");
+ }
+
+ // Allocate some caps:
+ struct capref c1;
+ err = frame_alloc(&c1, 4096, NULL);
+ assert(err_is_ok(err));
+
+ struct frame_identity f1;
+ err = invoke_frame_identify(c1, &f1);
+ assert(err_is_ok(err));
+
+ struct capref c2;
+ err = frame_alloc(&c2, 4096, NULL);
+ assert(err_is_ok(err));
+
+ struct frame_identity f2;
+ err = invoke_frame_identify(c2, &f2);
+ assert(err_is_ok(err));
+ printf("%s:%s:%d:\n", __FILE__, __FUNCTION__, __LINE__);
+
+ // Store them in the SKB
+ err = skb_add_fact("cap(frame(%s, p(%zu, %Q))).", "cap1", f1.base, c1);
+ if (err_is_fail(err)) {
+ USER_PANIC_ERR(err, "Cap storage in SKB failed.");
+ }
+ printf("%s:%s:%d:\n", __FILE__, __FUNCTION__, __LINE__);
+
+ err = skb_add_fact("cap(frame(%s, p(%zu, %Q))).", "cap2", f2.base, c2);
+ if (err_is_fail(err)) {
+ USER_PANIC_ERR(err, "Cap storage in SKB failed.");
+ }
+ printf("%s:%s:%d:\n", __FILE__, __FUNCTION__, __LINE__);
+
+ // Try and get them back:
+ err = skb_execute_query("cap(frame(cap1, A)),writeln(A).");
+ uint64_t base;
+ struct capref rc1;
+ printf("%s:%s:%d:\n", __FILE__, __FUNCTION__, __LINE__);
+
+ err = skb_read_output("p(%lu, %Q)", &base, &rc1);
+ if (err_is_fail(err)) {
+ USER_PANIC_ERR(err, "call failed.");
+ }
+ if (f1.base != base) {
+ USER_PANIC_ERR(err, "Parsing frame address from fact failed.");
+ }
+
+ struct frame_identity rcf1;
+ err = invoke_frame_identify(rc1, &rcf1);
+ if (f1.base != rcf1.base) {
+ USER_PANIC_ERR(err, "Address doesn't match. We got the wrong cap?");
+ }
+
+ err = skb_execute_query("cap(frame(cap2, A)),write(A)");
+ uint64_t base2;
+ struct capref rc2;
+ printf("%s:%s:%d:\n", __FILE__, __FUNCTION__, __LINE__);
+
+ err = skb_read_output("p(%lu, %Q)", &base2, &rc2);
+ if (err_is_fail(err)) {
+ USER_PANIC_ERR(err, "call failed.");
+ }
+ if (f2.base != base2) {
+ USER_PANIC_ERR(err, "Parsing frame address from fact failed.");
+ }
+
+ struct frame_identity rcf2;
+ err = invoke_frame_identify(rc2, &rcf2);
+ if (f2.base != rcf2.base) {
+ USER_PANIC_ERR(err, "Address doesn't match. We got the wrong cap?");
+ }
+
+ printf("SUCCESS\n");
+ return 0;
+}