Initial commit

parents
Pipeline #5648662 passed with stage
in 6 minutes 51 seconds
# Compiled files
*.o
*.so
*.rlib
*.dll
*.pyc
# Executables
*.exe
# Generated by Cargo
/target/
Cargo.lock
build:
image: registry.gitlab.com/robigalia/runner:latest
script:
- "xargo build --target i686-sel4-unknown --no-default-features"
- "xargo build --target arm-sel4-gnueabi --no-default-features"
- "xargo build --target arm-sel4-gnueabihf --no-default-features"
- "cargo test"
- "cargo test --release"
verify_signatures:
image: ubuntu:16.10
script:
- apt update
- apt install --assume-yes python-pexpect gnupg2 git
- git clone --depth=1 https://gitlab.com/robigalia/meta
- gpg2 --list-keys # to force it to create GNUPGHOME instead of racing in the pipe below
- gpg2 --export --no-default-keyring --keyring ./meta/.gnupg/pubring.kbx | gpg2 --import
- gpg2 --list-keys --fingerprint --fingerprint --verbose
- ./meta/verify-signatures.py HEAD ./meta/.mailmap
Thank you for your interest in contributing to the Robigalia project! There
are many ways to contribute, and we appreciate all of them.
If you have questions, please send an email to
[robigalia-dev@lists.robigalia.org][list] or hop on [#robigalia][irc].
As a reminder, all participants in our community are expected to honor our
[code of conduct][conduct].
[list]: mailto:robigalia-dev@lists.robigalia.org
[irc]: https://webchat.freenode.net/?channels=%23robigalia
[conduct]: https://robigalia.org/conduct.html
## Feature Proposal
To propose a change to the way that Robigo or any other Robigalia codebase
works, please open an issue directly on the relevant repository. Include the
text, `[feature-proposal]` in the title and someone will come by and re-tag
the issue appropriately. Here's a template you can use to file a feature
proposal, though it's not necessary to use it exactly:
```
One-paragraph summary
# Details
As many details as you think are necessary to communicate how the feature
should work.
# Benefits
Benefits of the feature.
# Drawbacks
Drawbacks of the feature.
```
There is [an example feature proposal][prop] if you want to see what it looks
like.
[prop]: https://gitlab.com/robigalia/meta/issues/1
## Bug Reports
While bugs are unfortunate, they're a reality in software. We can't fix what we
don't know about, so please report liberally. If you're not sure if something
is a bug or not, feel free to file a bug anyway.
**If you believe reporting your bug publicly represents a security risk to
users of software developed by the Robigalia project,
please follow our [instructions for reporting security
vulnerabilities](https://robigalia.org/security.html)**.
If you have the chance, before reporting a bug, please [search existing
issues](https://gitlab.com/groups/robigalia/issues) as it's possible that
someone else has already reported your error. This doesn't always work, and
sometimes it's hard to know what to search for, so consider this extra credit.
We won't mind if you accidentally file a duplicate report, we'll typically
close it and point out which issue is a duplicate of.
Opening an issue is as easy as following [this
link](https://gitlab.com/groups/robigalia/issues) and filling out the fields
after clicking "New Issue". Here's a template that you can use to file a bug,
though it's not necessary to use it exactly:
<short summary of the bug>
I tried this:
<testcase demonstrating the bug>
I expected to see this happen: <explanation>
Instead, this happened: <explanation>
All three components are important: what you did, what you expected, what
happened instead.
## Submitting code
To coordinate changes to our software, we use a feature of GitLab called
"merge requests". Alternatively, you can email patches (ideally with git
send-email) to [the development mailing list][list].
### Commit messages
Commit messages should be self-contained and describe the motivation for a
change. The subject line should be short, with any elaborations in the body.
If the commit closes an issue, write "Closes #issuenumber" at the end of the
body.
For some guidelines, read [this][chrisbeams] for the basics, and [this][pro]
to become a pro.
[chrisbeams]: http://chris.beams.io/posts/git-commit/
[pro]: https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message
### Commit signing
For a [variety of reasons][horror], we use commit signing to verify the
authenticity and authorship of changes to our projects. If you don't already
have one, create a PGP key. There are many ways to do this. [This blog
post][keygen] by Alex Cabal has a decent explanation of how to do it and some
of the tradeoffs involved.
Once you have a keypair and it is uploaded to the keyservers, [learn how to
use gpg with git][horror2]. Please sign all commits you intend to include in a
merge request.
[horror]: https://mikegerwitz.com/papers/git-horror-story
[horror2]: https://mikegerwitz.com/papers/git-horror-story#trust-ensure
[keygen]: https://alexcabal.com/creating-the-perfect-gpg-keypair/
### Forking the repositories.
We use a custom system for managing our large amount of repositories. We have
one "master" repository, [devbox][devbox], which contains scripts for fetching
the other repositories. It also includes a [Vagrant][vagrant] configuration,
which is the easiest way to get started with Rust and seL4. See the readme in
that repository to see how to use the scripts and, optionally, set up Vagrant.
Part of the setup is running the `add_remotes.sh` script, which will rename
the official repo to `upstream` and add an `origin` remote pointing to a repo
under your own username.
To fork a repository, navigate to it on GitLab and click the "Fork project"
button", which is to the left of the repository URL:
![fork project button location image][forkimg]
Then, you can interact with that repository using the `origin` remote in the
relevant sub-repository of `devbox`.
[devbox]: https://gitlab.com/robigalia/devbox
[vagrant]: https://www.vagrantup.com/
[forkimg]: https://gitlab.com/robigalia/meta/raw/master/fork_button.png
### Signing the Developer Certificate of Origin
Before we can accept code you have written into our repositories, you must
agree to the Developers Certificate of Origin. You can view it [in this
repository][DCO]. It is quite minimalist, and is also used by the Linux
kernel. To do this, fork the meta repository and run a command like:
gpg --sign --armor < DCO.txt > agreements/${your_gitlab_username}
Create a new commit with that file and send a merge request.
[DCO]: https://gitlab.com/robigalia/meta/blob/master/DCO.txt
### Submitting a merge request
To submit a merge request, push the commits you want to include to a branch on
your fork of the relevant repository. Refer to the [official GitLab
documentation][mergereq] to see how to proceed from there.
Please open merge requests against the `master` branch. If needed, we will
merge into a separate branch manually.
[mergereq]: http://doc.gitlab.com/ce/gitlab-basics/add-merge-request.html
All merge requests are reviewed by another person.
If you want to request that a specific person reviews your pull request, you
can specify the "assignee" when you create the pull request. For example,
Corey usually reviews changes to sel4-sys, so you could specify him as the
assignee if you send a merge request to sel4-sys.
## Writing Documentation
Documentation improvements are very welcome. The source of robigalia.org is
in its [own repository][web], and individual crate documentation is hosted on
[doc.robigalia.org](https://doc.robigalia.org).
Documentation merge requests function in the same way as other merge requests.
[web]: https://gitlab.com/robigalia/robigalia.org
## Helpful Links and Information
- The [seL4 website](https://sel4.systems/) has things like the manual and how
to build seL4.
- The [Rust website](https://rust-lang.org/) for all your Rust-related
questions.
*This document adapted from <https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md>*
# Copyright (c) 2017 The Robigalia Project Developers
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT
# or http://opensource.org/licenses/MIT>, at your option. All files in the
# project carrying such notice may not be copied, modified, or distributed
# except according to those terms.
[package]
name = "ssmarshal"
version = "0.0.1"
authors = ["Corey Richardson <corey@octayn.net>"]
description = "Stupid simple value-only marshaling using serde"
documentation = "https://doc.robigalia.org/ssmarshal"
repository = "https://gitlab.com/robigalia/ssmarshal"
readme = "README.md"
license = "MIT OR Apache-2.0"
[features]
default = ["std"]
std = ["serde/std"]
[dependencies]
serde = { version = "0.8", default-features = false }
# ugh. FIXME eventually.
encode_unicode = { version = "0.2", default-features = false, features = ["no_std"] }
[dev-dependencies]
quickcheck = "0.4"
quickcheck_macros = "0.4"
serde_derive = "0.8"
This diff is collapsed. Click to expand it.
Copyright (c) 2015 The Robigalia Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
# ssmarshal
[![Crates.io](https://img.shields.io/crates/v/ssmarshal.svg?style=flat-square)](https://crates.io/crates/ssmarshal)
[Documentation](https://docs.rs/ssmarshal)
ssmarshal ("stupid simple marshaling") is a serde-based de/serialization
library. It is somewhat like [bincode](https://github.com/TyOverby/bincode),
but doesn't support String/Vec - this library is entirely zero-allocation, for
use in limited `no_std` contexts. The format is not incredibly compact, but
doesn't add extra fluff, and is quick to en/decode. The size of encoded values
will generally be the same as the in-memory representation, minus any padding.
For de/serializing a single value, a buffer of `size_of::<T>()` is always
enough.
All numbers are encoded as little-endian.
This format is not self-describing. To successfully deserialize a value, the
exact layout must be known ahead-of-time.
This is designed for doing IPC, not saving to disk or transferring over the
network. It may be useful for those cases, though.
This library is regularly fuzz tested with AFL for correct handling of
arbitrary input.
This diff is collapsed. Click to expand it.
// Copyright (c) 2017 The Robigalia Project Developers Licensed under the Apache License, Version
// 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. All files in the project
// carrying such notice may not be copied, modified, or distributed except according to those
// terms.
#![feature(proc_macro, plugin)]
#![plugin(quickcheck_macros)]
#![allow(non_snake_case)]
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate quickcheck;
extern crate ssmarshal;
use serde::{Serialize, Deserialize};
use ssmarshal::{serialize, deserialize};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct U8(u8);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct U16(u16);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct U32(u32);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct U64(u64);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct USize(usize);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct I8(i8);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct I16(i16);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct I32(i32);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct I64(i64);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct ISize(isize);
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct Simple {
a: u8,
b: u16,
c: u32,
d: u64,
e: i8
}
impl quickcheck::Arbitrary for Simple {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Simple {
Simple {
a: g.gen(),
b: g.gen(),
c: g.gen(),
d: g.gen(),
e: g.gen(),
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct Complex {
a: Simple,
b: Simple,
c: [u8; 7]
}
impl quickcheck::Arbitrary for Complex {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Complex {
Complex {
a: Simple::arbitrary(g),
b: Simple::arbitrary(g),
c: g.gen(),
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
enum ComplexEnum {
A,
B(Simple),
C(u8, u16),
D(isize),
E {
foo: Simple
},
F {
bar: Complex,
baz: Simple,
qux: char
}
}
impl quickcheck::Arbitrary for ComplexEnum {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> ComplexEnum {
match g.gen_range(0, 6) {
0 => {
ComplexEnum::A
},
1 => {
ComplexEnum::B(Simple::arbitrary(g))
},
2 => {
ComplexEnum::C(g.gen(), g.gen())
},
3 => {
ComplexEnum::D(g.gen())
},
4 => {
ComplexEnum::E { foo: Simple::arbitrary(g) }
},
5 => {
ComplexEnum::F { bar: Complex::arbitrary(g), baz: Simple::arbitrary(g), qux: g.gen() }
},
_ => unreachable!()
}
}
}
fn rt_val<T: Serialize + Deserialize + PartialEq+std::fmt::Debug>(val: &T) -> bool {
let mut buf = vec![0; std::mem::size_of::<T>()];
serialize(&mut buf, &val).unwrap();
let new_val: T = deserialize(&buf).unwrap().0;
println!("\n\nOld: {:?}\nNew: {:?}", val, new_val);
val == &new_val
}
#[quickcheck]
fn rt_simple(val: Simple) -> bool {
rt_val(&val)
}
#[quickcheck]
fn rt_complex(val: Complex) -> bool {
rt_val(&val)
}
#[quickcheck]
fn rt_complexenum(val: ComplexEnum) -> bool {
rt_val(&val)
}
macro_rules! rt {
($(($name:ident, $t:ty)),*) => {
$(#[quickcheck] fn $name(val: $t) -> bool {
rt_val::<$t>(&val)
})*
}
}
macro_rules! rt_wrap {
($(($name:ident, $t:ty, $n:ident)),*) => {
$(#[quickcheck] fn $name(val: $t) -> bool {
rt_val::<$n>(&$n(val))
})*
}
}
rt! {
(rt_i8, i8),
(rt_i16, i16),
(rt_i32, i32),
(rt_i64, i64),
(rt_u8, u8),
(rt_u16, u16),
(rt_u32, u32),
(rt_u64, u64),
(rt_usize, usize),
(rt_isize, isize),
(rt_tp1, (u8, u8, u8)),
(rt_tp2, (u8, i16, u8)),
(rt_tp3, (u8, i16, u8)),
(rt_tp4, (usize, i16, isize)),
(rt_char, char)
}
rt_wrap! {
(rt_I8, i8 , I8),
(rt_I16, i16, I16),
(rt_I32, i32, I32),
(rt_I64, i64, I64),
(rt_U8, u8 , U8),
(rt_U16, u16, U16),
(rt_U32, u32, U32),
(rt_U64, u64, U64)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment