Skip to content

Commit

Permalink
[twin] tesuite for twin into own crate (#306)
Browse files Browse the repository at this point in the history
Co-authored-by: xyz <xyz>
Co-authored-by: 0o-de-lally <[email protected]>
  • Loading branch information
sirouk and 0o-de-lally committed Aug 16, 2024
1 parent 74ab91c commit 79d4c54
Show file tree
Hide file tree
Showing 70 changed files with 36,575 additions and 1,023 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[env]
# set coin name for diem dependencies
RUST_DIEM_COIN_MODULE = "gas_coin"
RUST_DIEM_COIN_NAME = "LibraCoin"
RUST_DIEM_COIN_MODULE="libra_coin"
RUST_DIEM_COIN_NAME="LibraCoin"

[target.'cfg(target_os = "linux")']
# Dramatically increases the link performance for the eventbus
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ jobs:
run: |
echo "Main last commit has [breaking]: ${{ env.hasBreakingCommit }}"
- name: delete fixtures and force rebuild
working-directory: ./framework/src/upgrade_fixtures/fixtures
run: |
rm -rf upgrade-*
RUST_MIN_STACK=104857600 cargo t -- make_the_upgrade_fixtures --include-ignored
- name: upgrade - check workflow
if: always()
working-directory: ./upgrade-tests
Expand Down Expand Up @@ -289,3 +295,20 @@ jobs:
working-directory: ./tools/storage
# TODO: not testing the V6 file parsing
run: cargo test --no-fail-fast e2e_

twin-testsuite:
timeout-minutes: 60
needs: [build-framework]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: setup env
uses: ./.github/actions/build_env

- uses: Swatinem/[email protected]
with:
shared-key: "libra-framework"
cache-all-crates: true
- name: twin
working-directory: ./testsuites/twin
run: cargo test --no-fail-fast
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Cargo.lock
**/build
**/doc
**/framework_upgrade
# upgrade fixtures
**/framework/src/upgrade_fixtures/fixtures/upgrade*
# # upgrade fixtures
# **/framework/src/upgrade_fixtures/fixtures/upgrade*

sccache.log

Expand All @@ -28,4 +28,4 @@ diem/

# exclude move coverage
.coverage_map.mvcov
.trace
.trace
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"framework",
"framework/cached-packages",
"smoke-tests",
"testsuites/twin",
"tools/cli",
"tools/config",
"tools/genesis",
Expand Down Expand Up @@ -41,6 +42,7 @@ libra-rescue = { path = "tools/rescue" }
libra-storage = { path = "tools/storage" }
libra-smoke-tests = { path = "smoke-tests" }
libra-tower = { path = "tools/tower" }
libra-twin-tests = { path = "testsuites/twin" }
libra-types = { path = "types" }
libra-txs = { path = "tools/txs" }
libra-wallet = { path = "tools/wallet" }
Expand Down
5 changes: 0 additions & 5 deletions framework/libra-framework/sources/diem_governance.move
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,6 @@ module diem_framework::diem_governance {

// COMMIT NOTE: trigger_epoch() should now work on Stage as well.

// /// Return the voting power
// fun get_voting_power(_pool_address: address): u64 {
// 1
// }

#[view]
public fun get_next_governance_proposal_id():u64 {
voting::get_next_proposal_id<GovernanceProposal>(@diem_framework)
Expand Down
23 changes: 18 additions & 5 deletions framework/src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use diem_framework::{
};
use move_command_line_common::address::NumericalAddress;
use once_cell::sync::Lazy;
use std::{collections::BTreeMap, fmt::Display, path::PathBuf, str::FromStr};
use std::{collections::BTreeMap, env, fmt::Display, path::PathBuf, str::FromStr};

use crate::BYTECODE_VERSION;

Expand Down Expand Up @@ -90,13 +90,26 @@ impl ReleaseTarget {
}

pub fn create_release_options(self, dev_mode: bool, out: Option<PathBuf>) -> ReleaseOptions {
let crate_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
// Get the path to source. If we are running tests in cargo we
// can assume cargo manifest dir.
// Otherwise we assume the tool is being run in the source path

let source_path = if let Ok(p) = env::var("CARGO_MANIFEST_DIR") {
println!("using Cargo project path: {}", &p);
PathBuf::from(p)
} else {
env::current_dir().expect("could not get local current_dir")
};

// let crate_dir = crate_dir.parent().unwrap().to_path_buf();
let packages = self
.packages()
.into_iter()
.map(|(path, binding_path)| {
(crate_dir.join(path), binding_path.unwrap_or("").to_owned())
(
source_path.join(path),
binding_path.unwrap_or("").to_owned(),
)
})
.collect::<Vec<_>>();
ReleaseOptions {
Expand Down Expand Up @@ -126,7 +139,7 @@ impl ReleaseTarget {
.into_iter()
.map(|(_, binding)| {
if !binding.is_empty() {
crate_dir.join(binding).display().to_string()
source_path.join(binding).display().to_string()
} else {
binding
}
Expand All @@ -136,7 +149,7 @@ impl ReleaseTarget {
path
} else {
// Place in release directory //////// 0L ////////
crate_dir.join("releases/head.mrb")
source_path.join("releases/head.mrb")
},
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = 'upgrade_scripts'
version = '1.0.0'
authors = []
license = ''

[addresses]

[dev-addresses]
[dependencies.LibraFramework]
local = '/Users/lucas/code/rust/libra-framework/framework/libra-framework'

[dev-dependencies]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b7ed52a7612abd9bd633cb8c2f307b1316c39454f6753d3f8fe40f4f2f8bbdf9
Loading

0 comments on commit 79d4c54

Please sign in to comment.