-
Notifications
You must be signed in to change notification settings - Fork 5.4k
E2E Tests using the VM #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
655d991
begin register allocator
3e56e38
begin reg alloc
a7f469e
mutable virtual registers; basic allocation algorithm skeleton
5c50072
mutable registers in allocation
e407757
pull in fuel-asm official ops
f99b127
switching laptops
af1c112
begin work on virtual registers and ops
8d6f088
daily checkpoint
f44b7fd
add AllocatedOp abstraction
61705b9
template for parsing ops
8d21ff5
allocation algorithm progress
cfa3e4a
change op parsing logic
483c46d
WIP parsing inline asm to new ops
fb5d61a
more op parsing
1723aca
finish parsing virtual ops from asm
e961af7
start registers method
f61845b
register allocation method
c36dbb5
convert virtual registers to allocated ones
d35f6bf
switch back to organizational labels for jumps
3a973af
realized ops
d8c0b83
fully allocate registers and resolve labels
ea91252
print allocated registers
b822630
merge from master; fix reg alloc algo
8347dc3
fill in todo!() errors in asm parsing
d2b6b37
resolve all todosudo apt-get install vlc in core_lang
60c0b1c
switch to ssh for fuel-asm
2156b67
resolve warnings
2c126bf
fix git url
3598dd8
rustfmt
f3ea12e
Merge branch 'master' of github.com:FuelLabs/fuel-vm-hll into allocation
8344df4
small self-code-review
cd6dbb5
resolve module
4315bc2
map the virtual opcodes to fuel_asm ops
a2a3ee7
code review feedback
a2551fb
Merge branch 'allocation' of github.com:FuelLabs/fuel-vm-hll into act…
7b87ee0
factor finalized asm out into its own file
f3dd962
merge from master
31e9f29
realize data section and instructions to bits
c39141a
data section offset label
5c21259
initial bytecode generation
11e6a17
add forc --asm command
e3c1d1a
print out the loading of the data section op
db009fb
resolve warnings
1e27b4c
begin VM tests
f23350d
fix register allocater bug
1b74664
cleanup
980e9c7
fix bad error message
6d27fb3
Merge branch 'actual_bytecode' of github.com:fuellabs/fuel-vm-hll int…
13507d5
some tiny tweaks
05f347c
fix opcode encoding bug
54fae97
fix off-by-one error
86cb504
Merge branch 'master' of github.com:fuellabs/fuel-vm-hll into vm_tests
3c42de9
change all tests to run in the vm
2f45da4
proper allocation size for structs
88217bd
code review feedback
fafb111
Merge branch 'master' of github.com:fuellabs/fuel-vm-hll into actual_…
22237bc
use ssh for deps
a7c4d4a
undo rename
0babc0b
fix doctest
01af3d0
fix typo
3cea222
reference fuel_core for register constants
e0fe2fc
new ssh key
6f0127d
git change rust version
72e49a4
wrong rust version
90e72c0
Merge branch 'actual_bytecode' of github.com:fuellabs/fuel-vm-hll int…
e6f5cf8
update lockfile
490bcd9
fix jump and enum instantiation bugs
sezna 901fc57
merge from master
sezna da1d1f4
fix toml
sezna b59f3eb
lockfile
sezna ab0327d
code review feedback
sezna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
script; | ||
predicate; | ||
struct Rgb { | ||
red: u64, | ||
green: u64, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use forc; | ||
|
||
use fuel_tx::Transaction; | ||
use fuel_vm_rust::interpreter::Interpreter; | ||
|
||
/// Very basic check that code does indeed run in the VM. | ||
/// `true` if it does, `false` if not. | ||
pub(crate) fn runs_in_vm(file_name: &str) { | ||
let script = compile_to_bytes(file_name); | ||
let gas_price = 10; | ||
let gas_limit = 10000; | ||
let maturity = 100; | ||
let script_data = vec![]; | ||
let inputs = vec![]; | ||
let outputs = vec![]; | ||
let witness = vec![]; | ||
let tx = Transaction::script( | ||
gas_price, | ||
gas_limit, | ||
maturity, | ||
script, | ||
script_data, | ||
inputs, | ||
outputs, | ||
witness, | ||
); | ||
let block_height = (u32::MAX >> 1) as u64; | ||
tx.validate(block_height).unwrap(); | ||
Interpreter::execute_tx(tx).unwrap(); | ||
} | ||
|
||
/// Returns `true` if a file compiled without any errors or warnings, | ||
/// and `false` if it did not. | ||
pub(crate) fn compile_to_bytes(file_name: &str) -> Vec<u8> { | ||
println!("Compiling {}", file_name); | ||
let manifest_dir = env!("CARGO_MANIFEST_DIR"); | ||
let res = forc::ops::forc_build::build(Some(format!( | ||
"{}/src/e2e_vm_tests/test_programs/{}", | ||
manifest_dir, file_name | ||
))); | ||
match res { | ||
sezna marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Ok(bytes) => bytes, | ||
Err(_) => { | ||
panic!( | ||
"TEST FAILURE: Project \"{}\" failed to compile. ", | ||
file_name | ||
); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
mod harness; | ||
|
||
pub fn run() { | ||
let project_names = vec!["script_1", "script_2", "script_3"]; | ||
project_names.into_iter().for_each(|name| { | ||
crate::e2e_vm_tests::harness::runs_in_vm(name); | ||
}); | ||
} |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...on_tests/test_programs/script_3/Forc.toml → ...vm_tests/test_programs/script_2/Forc.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...on_tests/test_programs/script_2/Forc.toml → ...vm_tests/test_programs/script_3/Forc.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.