Show commit in `--version` and ledger-tool's log (#12636)

* Show commit in `--version` and ledger-tool's log

* Another handy hidden env var

* Fix test

* Rename to semver!

* Fix syntax error...
This commit is contained in:
Ryo Onodera 2020-10-04 00:30:26 +09:00 committed by GitHub
parent 337da184f3
commit 026e7de819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 3 deletions

View File

@ -44,7 +44,7 @@ fn test_rpc_client() {
assert_eq!(
client.get_version().unwrap().solana_core,
solana_version::version!()
solana_version::semver!()
);
assert!(client.get_account(&bob_pubkey).is_err());

View File

@ -1246,6 +1246,8 @@ fn main() {
)
.get_matches();
info!("{} {}", crate_name!(), solana_version::version!());
let ledger_path = PathBuf::from(value_t!(matches, "ledger_path", String).unwrap_or_else(
|_err| {
eprintln!(

4
run.sh
View File

@ -34,6 +34,8 @@ export RUST_BACKTRACE=1
dataDir=$PWD/config/"$(basename "$0" .sh)"
ledgerDir=$PWD/config/ledger
SOLANA_RUN_SH_CLUSTER_TYPE=${SOLANA_RUN_SH_CLUSTER_TYPE:-development}
set -x
validator_identity="$dataDir/validator-identity.json"
if [[ -e $validator_identity ]]; then
@ -78,7 +80,7 @@ else
"$dataDir"/validator-vote-account.json \
"$dataDir"/validator-stake-account.json \
--ledger "$ledgerDir" \
--cluster-type development \
--cluster-type "$SOLANA_RUN_SH_CLUSTER_TYPE" \
$SPL_GENESIS_ARGS \
$SOLANA_RUN_SH_GENESIS_ARGS
fi

View File

@ -91,12 +91,19 @@ impl fmt::Debug for Version {
impl Sanitize for Version {}
#[macro_export]
macro_rules! version {
macro_rules! semver {
() => {
&*format!("{}", $crate::Version::default())
};
}
#[macro_export]
macro_rules! version {
() => {
&*format!("{:?}", $crate::Version::default())
};
}
#[cfg(test)]
mod test {
use super::*;