Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
HermitOS
kernel
Commits
833f8eec
Commit
833f8eec
authored
6 years ago
by
Stefan Lankes
Browse files
Options
Downloads
Patches
Plain Diff
add tests for the unikernel
parent
c4b46db8
Branches
crate
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/Cargo.toml
+9
-0
9 additions, 0 deletions
examples/Cargo.toml
examples/Makefile
+10
-0
10 additions, 0 deletions
examples/Makefile
examples/src/main.rs
+53
-0
53 additions, 0 deletions
examples/src/main.rs
with
72 additions
and
0 deletions
examples/Cargo.toml
0 → 100644
+
9
−
0
View file @
833f8eec
[package]
name
=
"hctests"
version
=
"0.1.0"
authors
=
[
"Stefan Lankes <slankes@eonerc.rwth-aachen.de>"
]
edition
=
"2018"
[dependencies]
[workspace]
This diff is collapsed.
Click to expand it.
examples/Makefile
0 → 100644
+
10
−
0
View file @
833f8eec
RM
=
rm
-rf
#TARGET =
TARGET
=
--target
x86_64-unknown-hermit
#TARGET = --target x86_64-unknown-linux-gnu
all
:
cargo build
--tests
$(
TARGET
)
clean
:
$(
RM
)
target
This diff is collapsed.
Click to expand it.
examples/src/main.rs
0 → 100644
+
53
−
0
View file @
833f8eec
#![feature(test)]
extern
crate
test
;
#[cfg(test)]
mod
tests
{
use
super
::
*
;
use
std
::
thread
;
use
test
::
Bencher
;
fn
pi
(
nthreads
:
u64
,
num_steps
:
u64
)
{
let
step
=
1.0
/
num_steps
as
f64
;
let
mut
sum
=
0.0
as
f64
;
let
threads
:
Vec
<
_
>
=
(
0
..
nthreads
)
.map
(|
tid
|
{
thread
::
spawn
(
move
||
{
let
mut
partial_sum
=
0
as
f64
;
let
start
=
(
num_steps
/
nthreads
)
*
tid
;
let
end
=
(
num_steps
/
nthreads
)
*
(
tid
+
1
);
for
i
in
start
..
end
{
let
x
=
(
i
as
f64
+
0.5
)
*
step
;
partial_sum
+=
4.0
/
(
1.0
+
x
*
x
);
}
partial_sum
})
})
.collect
();
for
t
in
threads
{
sum
+=
t
.join
()
.unwrap
();
}
println!
(
"Pi: {}"
,
sum
*
(
1.0
/
num_steps
as
f64
));
}
#[bench]
fn
bench_pi
(
b
:
&
mut
Bencher
)
{
b
.iter
(||
pi
(
2
,
10000000
));
}
#[test]
fn
hello
()
{
println!
(
"Hello, world!"
);
}
}
fn
main
()
{
println!
(
"Please use `cargo test --no-run' to build the tests"
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment