Skip to content

chore: add windows bat scripts for unit tests #186

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
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 34 additions & 21 deletions era-compiler-solidity/tests/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ mod threads;
mod version;
mod yul;

macro_rules! test_script_path {
($name:ident, $base:expr) => {
#[cfg(target_os = "windows")]
pub const $name: &str = concat!($base, ".bat");
#[cfg(not(target_os = "windows"))]
pub const $name: &str = concat!($base, ".sh");
};
}

/// A test input file.
pub const TEST_CONTRACTS_PATH: &str = "tests/data/contracts/";

Expand Down Expand Up @@ -189,27 +198,31 @@ pub const TEST_LINKER_BYTECODE_COPY_PATH: &str = "tests/data/bytecodes/linker_co
/// The broken input file path.
pub const TEST_BROKEN_INPUT_PATH: &str = "tests/data/broken.bad";

/// A test constant.
pub const TEST_SCRIPT_SOLC_VERSION_OUTPUT_ERROR_PATH: &str =
"tests/scripts/solc_version_output_error.sh";

/// A test constant.
pub const TEST_SCRIPT_SOLC_VERSION_TOO_OLD_PATH: &str = "tests/scripts/solc_version_too_old.sh";

/// A test constant.
pub const TEST_SCRIPT_SOLC_VERSION_TOO_NEW_PATH: &str = "tests/scripts/solc_version_too_new.sh";

/// A test constant.
pub const TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_LINES_PATH: &str =
"tests/scripts/solc_version_not_enough_lines.sh";

/// A test constant.
pub const TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_WORDS_IN_2ND_LINE_PATH: &str =
"tests/scripts/solc_version_not_enough_words_in_2nd_line.sh";

/// A test constant.
pub const TEST_SCRIPT_SOLC_VERSION_PARSING_ERROR_PATH: &str =
"tests/scripts/solc_version_parsing_error.sh";
/// Shell script test constants.
test_script_path!(
TEST_SCRIPT_SOLC_VERSION_OUTPUT_ERROR_PATH,
"tests/scripts/solc_version_output_error"
);
test_script_path!(
TEST_SCRIPT_SOLC_VERSION_TOO_OLD_PATH,
"tests/scripts/solc_version_too_old"
);
test_script_path!(
TEST_SCRIPT_SOLC_VERSION_TOO_NEW_PATH,
"tests/scripts/solc_version_too_new"
);
test_script_path!(
TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_LINES_PATH,
"tests/scripts/solc_version_not_enough_lines"
);
test_script_path!(
TEST_SCRIPT_SOLC_VERSION_NOT_ENOUGH_WORDS_IN_2ND_LINE_PATH,
"tests/scripts/solc_version_not_enough_words_in_2nd_line"
);
test_script_path!(
TEST_SCRIPT_SOLC_VERSION_PARSING_ERROR_PATH,
"tests/scripts/solc_version_parsing_error"
);

/// A test constant.
pub const LIBRARY_DEFAULT: &str = "tests/data/contracts/solidity/MiniMath.sol:MiniMath=0xF9702469Dfb84A9aC171E284F71615bd3D3f1EdC";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
echo 'solc, the solidity compiler commandline interface'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo 'solc, the solidity compiler commandline interface'
echo 'solc, the solidity compiler commandline interface'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@ECHO OFF
echo 'solc, the solidity compiler commandline interface'
echo 'Version:'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo 'solc, the solidity compiler commandline interface'
echo 'Version:'
echo 'Version:'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
exit 1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

exit 1
exit 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@ECHO OFF
echo 'solc, the solidity compiler commandline interface'
echo 'Version: x.y.z+commit.deadbeef.platform.toolchain'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo 'solc, the solidity compiler commandline interface'
echo 'Version: x.y.z+commit.deadbeef.platform.toolchain'
echo 'Version: x.y.z+commit.deadbeef.platform.toolchain'
3 changes: 3 additions & 0 deletions era-compiler-solidity/tests/scripts/solc_version_too_new.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@ECHO OFF
echo 'solc, the solidity compiler commandline interface'
echo 'Version: 0.8.29+commit.deadbeef.platform.toolchain'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo 'solc, the solidity compiler commandline interface'
echo 'Version: 0.8.29+commit.deadbeef.platform.toolchain'
echo 'Version: 0.8.29+commit.deadbeef.platform.toolchain'
3 changes: 3 additions & 0 deletions era-compiler-solidity/tests/scripts/solc_version_too_old.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@ECHO OFF
echo 'solc, the solidity compiler commandline interface'
echo 'Version: 0.4.11+commit.deadbeef.platform.toolchain'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo 'solc, the solidity compiler commandline interface'
echo 'Version: 0.4.11+commit.deadbeef.platform.toolchain'
echo 'Version: 0.4.11+commit.deadbeef.platform.toolchain'
Loading