Skip to content

Commit e263a7b

Browse files
author
Yucong Sun
committed
Import testsuite
1 parent fb077d7 commit e263a7b

File tree

13 files changed

+2553
-29
lines changed

13 files changed

+2553
-29
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ cd ..
1010
# Then build rust client
1111
cd rust
1212
cargo build
13-
cargo test
1413
cd ..
1514

1615
# C Stuff
@@ -21,5 +20,6 @@ cmake ..
2120
make VERBOSE=1
2221

2322
# Test!
23+
cd rust && ./test.sh && cd ..
2424
./c/c-client
2525
./cpp/cpp-client

rust/Cargo.lock

Lines changed: 1751 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,19 @@ crash-handler = { git = "https://github.com/libra/libra.git", branch = "testnet
4444
failure = { package = "libra-failure-ext", git = "https://github.com/libra/libra.git", branch = "testnet" }
4545
libra-logger = { git = "https://github.com/libra/libra.git", branch = "testnet" }
4646
libra-metrics = { git = "https://github.com/libra/libra.git", branch = "testnet" }
47-
libra-tools = { git = "https://github.com/libra/libra.git", branch = "testnet" }
47+
libra-tools = { git = "https://github.com/libra/libra.git", branch = "testnet" }
4848

4949
[build-dependencies]
5050
bindgen = "0.51.1"
5151

5252
[dev-dependencies]
5353
proptest = "0.9.2"
54+
libra-swarm = { git = "https://github.com/libra/libra.git", branch = "testnet" }
55+
libra-node = { git = "https://github.com/libra/libra.git", branch = "testnet" }
56+
generate-keypair = { git = "https://github.com/libra/libra.git", branch = "testnet" }
57+
compiler = { git = "https://github.com/libra/libra.git", branch = "testnet" }
5458

5559
[features]
5660
# FIXEME
57-
default = ["libra-crypto/cloneable-private-keys"]
61+
default = []
5862
fuzzing = ["proptest", "libra-crypto/fuzzing", "fixme-libra-types/fuzzing"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Defaults are now set in config.rs
2+
3+
[[networks]]
4+
seed_peers_file = "" # For direct validation of this file
5+
network_keypairs_file = "" # For direct validation of this file
6+
network_peers_file = "" # For direct validation of this file
7+
role = "full_node"
8+
9+
[consensus]
10+
consensus_keypair_file = "" # For direct validation of this file
11+
consensus_peers_file = "" # For direct validation of this file
12+
13+
[state_sync]
14+
upstream_peers = ["ae1b54220905fca36d046a6e093632ed1f219e0a35a4fd7ba82e6e0d515f0b8e"]
15+
16+
[vm_config]
17+
[vm_config.publishing_options]
18+
type = "Locked"
19+
whitelist = [
20+
"ae1b54220905fca36d046a6e093632ed1f219e0a35a4fd7ba82e6e0d515f0b8e",
21+
"fb999f2d6f45efc9b991993e332f40760171de8a46db40ca93f1baff56842c44",
22+
"6465374a3ecf6d1a3836bbab3bcd624244a0217530a601fa20de80d562f87d80",
23+
"774b10985dd9bf17ddee899256942c1dc0ab2c1b07d99ec78f774651f01e04b8"
24+
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Defaults are now set in config.rs
2+
[[networks]]
3+
seed_peers_file = "" # For direct validation of this file
4+
network_keypairs_file = "" # For direct validation of this file
5+
network_peers_file = "" # For direct validation of this file
6+
role = "validator"
7+
8+
[consensus]
9+
consensus_keypair_file = "" # For direct validation of this file
10+
consensus_peers_file = "" # For direct validation of this file
11+
12+
[vm_config]
13+
[vm_config.publishing_options]
14+
type = "Locked"
15+
whitelist = [
16+
"6aabc87f543f85e10216432d02b0251297d4c7723e906de481dfa04b057c2371",
17+
"1cf66b5f5c911e80dad222b8ee8dfe3ad4830f75bb412ba12ea8e429203d9c83",
18+
"a2180395d1632a0793f34e8a8a6be20b3b03bdceee35affe8c751fc8467b73a4",
19+
"5ee07d4ac1ecf88f1b41c2c458f15699fe9d811c61563338253b3807b75c04c1",
20+
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[base]
2+
data_dir_path = '/tmp/libra/test_persistent'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
global:
2+
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
3+
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
4+
# scrape_timeout is set to the global default (10s).
5+
6+
# Alertmanager configuration
7+
alerting:
8+
alertmanagers:
9+
- static_configs:
10+
- targets:
11+
# - alertmanager:9093
12+
13+
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
14+
rule_files:
15+
# - "first_rules.yml"
16+
# - "second_rules.yml"
17+
18+
# A scrape configuration containing exactly one endpoint to scrape:
19+
# Here it's Prometheus itself.
20+
scrape_configs:
21+
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
22+
- job_name: 'libra-node'
23+
honor_labels: true
24+
25+
# metrics_path defaults to '/metrics'
26+
# scheme defaults to 'http'.
27+
28+
static_configs:
29+
- targets: ['127.0.0.1:9091']

rust/src/client_proxy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ impl ClientProxy {
468468
let dependencies_file = self.handle_dependencies(tmp_source_path.display(), is_module)?;
469469

470470
let mut args = format!(
471-
"run -p compiler -- {} -a {}{}",
471+
"{} -a {}{}",
472472
tmp_source_path.display(),
473473
address,
474474
if is_module { " -m" } else { "" },
@@ -477,7 +477,7 @@ impl ClientProxy {
477477
args.push_str(&format!(" --deps={}", file.as_ref().display()));
478478
}
479479

480-
let status = Command::new("cargo")
480+
let status = Command::new("./target/debug/compiler")
481481
.args(args.split(' '))
482482
.spawn()?
483483
.wait()?;
@@ -497,11 +497,11 @@ impl ClientProxy {
497497
source_path: Display,
498498
is_module: bool,
499499
) -> Result<Option<TempPath>> {
500-
let mut args = format!("run -p compiler -- -l {}", source_path);
500+
let mut args = format!("-l {}", source_path);
501501
if is_module {
502502
args.push_str(" -m");
503503
}
504-
let child = Command::new("cargo")
504+
let child = Command::new("./target/debug/compiler")
505505
.args(args.split(' '))
506506
.stdout(Stdio::piped())
507507
.spawn()?;

rust/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cargo build -p libra-node
2+
cargo build -p compiler
3+
cargo test --features=fuzzing
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) The Libra Core Contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
module MyModule {
5+
import 0x0.LibraCoin;
6+
7+
// The identity function for coins: takes a LibraCoin.T as input and hands it back
8+
public id(c: LibraCoin.T): LibraCoin.T {
9+
return move(c);
10+
}
11+
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) The Libra Core Contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import 0x0.LibraAccount;
5+
import 0x0.LibraCoin;
6+
import {{sender}}.MyModule;
7+
8+
main(recipient: address, amount: u64) {
9+
let coin: LibraCoin.T;
10+
coin = LibraAccount.withdraw_from_sender(move(amount));
11+
LibraAccount.deposit(move(recipient), MyModule.id(move(coin)));
12+
return;
13+
}

rust/tests/libratest/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Copyright (c) The Libra Core Contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
mod smoke_test;

0 commit comments

Comments
 (0)