-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
…rpaas/evm-jsontests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few grumbles, mostly on docs/discoverability.
use super::HookType; | ||
|
||
/// Run chain jsontests on a given folder. | ||
pub fn run_test_path<H: FnMut(&str, HookType)>(p: &Path, skip: &[&'static str], h: &mut H) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 7 identical pub fn run_test_path
added in this PR – would it be possible to avoid some boilerplate and have a single copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those functions are wrappers for the parent run_test_path
function. Before none of them are exposed, but I figured it would be helpful to add them there, as it simplify library user's work to figure out how those functions are meant to be used.
They're not entirely identical -- the function parameter passed is different, determining which type of tests it operates on. But I'm open to any idea if we can make this better and avoid duplications. :)
/// Indicate the type of the hook passed to test functions. | ||
#[derive(Copy, Clone, Eq, PartialEq)] | ||
pub enum HookType { | ||
/// Hook passed on starting of a test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this is better? "Hook to code to run on test start"
pub enum HookType { | ||
/// Hook passed on starting of a test. | ||
OnStart, | ||
/// Hook passed on a test is finished. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this is better? "Hook to code to run on test end"
@@ -21,7 +21,20 @@ use std::path::Path; | |||
use std::ffi::OsString; | |||
pub use ethereum_types::{H256, U256, Address}; | |||
|
|||
pub fn run_test_path(p: &Path, skip: &[&'static str], runner: fn (json_data: &[u8]) -> Vec<String>) { | |||
/// Indicate the type of the hook passed to test functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps "Indicate when to run the hook passed to test functions."?
evmbin/src/main.rs
Outdated
@@ -76,6 +77,9 @@ State test options: | |||
--only NAME Runs only a single test matching the name. | |||
--chain CHAIN Run only tests from specific chain. | |||
|
|||
Stats jsontests VM options: | |||
--folder Run jsontest for a folder instead of a single file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this not be inferred from the input path? If it's a file => run the file; if it's a folder => run all tests within?
evmbin/src/main.rs
Outdated
@@ -61,6 +61,7 @@ EVM implementation for Parity. | |||
Usage: | |||
parity-evm state-test <file> [--json --std-json --only NAME --chain CHAIN] | |||
parity-evm stats [options] | |||
parity-evm stats-jsontests-vm <file> [--folder] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the command in itself does not seem sufficient to understand what this does. Not sure where the best place to put a proper description of what it does and what the output format is would be, but I think it'd be very useful.
evmbin/src/main.rs
Outdated
use std::collections::HashMap; | ||
use std::time::{Instant, Duration}; | ||
|
||
let file = args.arg_file.expect("FILE is required"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"FILE (or PATH) is required"?
evmbin/src/main.rs
Outdated
|
||
let file = args.arg_file.expect("FILE is required"); | ||
|
||
let mut times: HashMap<String, (Instant, Option<Duration>)> = HashMap::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I suggest calling this timings
.
1200c22
to
a7d05b5
Compare
* master: EVM benchmark utilities (#8944)
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: parity: omit redundant last imported block number in light sync informant (openethereum#8962) Disable hardware-wallets on platforms that don't support `libusb` (openethereum#8464) Bump error-chain and quick_error versions (openethereum#8972) EVM benchmark utilities (openethereum#8944) parity: hide legacy options from cli --help (openethereum#8967) scripts: fix docker build tag on latest using master (openethereum#8952) Add type for passwords. (openethereum#8920)
rel #8914, #6744
Expose jsontests helpers from ethcore so that they can be used elsewhere. Allow hooking to start/stop point of each test so that time information can be recorded. Add a command in
evmbin
:This runs executive standard jsontests against a specific folder/file, record the timing information, and then output them in tsv format. This would allow those benchmark info to be compared.
evmbin/bench.sh
is moved toscripts
, and a new script is added, calledevm_jsontests_bench.sh
, which runs the above command on all available vm jsontests.I also changed all scripts to use
/usr/bin/env
instead of/bin/bash
. The later would mean it breaks on all non-FHS Linux systems (like NixOS).