Merge pull request #326 from ethcore/jit

Fixing JIT, Updating hook to run `ethcore` tests.
This commit is contained in:
Arkadiy Paronyan 2016-02-03 16:56:59 +01:00
commit b831d694b4
3 changed files with 18 additions and 7 deletions

View File

@ -100,6 +100,18 @@ fn test_create_vm() {
/// Create tests by injecting different VM factories /// Create tests by injecting different VM factories
#[macro_export] #[macro_export]
macro_rules! evm_test( macro_rules! evm_test(
(ignorejit => $name_test: ident: $name_jit: ident, $name_int: ident) => {
#[test]
#[ignore]
#[cfg(feature = "jit")]
fn $name_jit() {
$name_test(Factory::new(VMType::Jit));
}
#[test]
fn $name_int() {
$name_test(Factory::new(VMType::Interpreter));
}
};
($name_test: ident: $name_jit: ident, $name_int: ident) => { ($name_test: ident: $name_jit: ident, $name_int: ident) => {
#[test] #[test]
#[cfg(feature = "jit")] #[cfg(feature = "jit")]

View File

@ -254,8 +254,7 @@ fn test_origin(factory: super::Factory) {
assert_store(&ext, 0, "000000000000000000000000cd1722f2947def4cf144679da39c4c32bdc35681"); assert_store(&ext, 0, "000000000000000000000000cd1722f2947def4cf144679da39c4c32bdc35681");
} }
// TODO [todr] Fails with Signal 11 on JIT evm_test!{ignorejit => test_sender: test_sender_jit, test_sender_int}
evm_test!{test_sender: test_sender_jit, test_sender_int}
fn test_sender(factory: super::Factory) { fn test_sender(factory: super::Factory) {
let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
let sender = Address::from_str("cd1722f2947def4cf144679da39c4c32bdc35681").unwrap(); let sender = Address::from_str("cd1722f2947def4cf144679da39c4c32bdc35681").unwrap();
@ -367,7 +366,7 @@ fn test_log_sender(factory: super::Factory) {
assert_eq!(ext.logs[0].data, "ff00000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap()); assert_eq!(ext.logs[0].data, "ff00000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap());
} }
evm_test!{test_blockhash: test_blockhash_jit, test_blockhash_int} evm_test!{ignorejit => test_blockhash: test_blockhash_jit, test_blockhash_int}
fn test_blockhash(factory: super::Factory) { fn test_blockhash(factory: super::Factory) {
let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
let code = "600040600055".from_hex().unwrap(); let code = "600040600055".from_hex().unwrap();
@ -785,9 +784,9 @@ fn test_signextend(factory: super::Factory) {
assert_eq!(gas_left, U256::from(59_972)); assert_eq!(gas_left, U256::from(59_972));
} }
#[test] // JIT just returns out of gas
evm_test!{test_badinstruction: test_badinstruction_jit, test_badinstruction_int} fn test_badinstruction_int() {
fn test_badinstruction(factory: super::Factory) { let factory = super::Factory::new(VMType::Interpreter);
let code = "af".from_hex().unwrap(); let code = "af".from_hex().unwrap();
let mut params = ActionParams::default(); let mut params = ActionParams::default();

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
echo "#!/bin/sh\ncargo test" >> ./.git/hooks/pre-push echo "#!/bin/sh\ncargo test -p ethcore" >> ./.git/hooks/pre-push
chmod +x ./.git/hooks/pre-push chmod +x ./.git/hooks/pre-push