Browse Source

Prevent `test262` repository update if not needed (#3386)

This also removes documentation section about `test262` submodule.
pull/3387/head
Haled Odat 7 months ago committed by GitHub
parent
commit
66c2bf4304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CONTRIBUTING.md
  2. 25
      boa_tester/src/main.rs

6
CONTRIBUTING.md

@ -75,12 +75,6 @@ with this command:
cargo run --release --bin boa_tester -- run -v 2> error.log
```
Note that this requires the `test262` submodule to be checked out, so you will need to run the following first:
```shell
git submodule init && git submodule update
```
This will run the test suite in verbose mode (you can remove the `-v` part to run it in non-verbose mode),
and output nice colorings in the terminal. It will also output any panic information into the `error.log` file.

25
boa_tester/src/main.rs

@ -294,7 +294,10 @@ fn main() -> Result<()> {
}
/// Returns the commit hash and commit message of the provided branch name.
fn get_last_branch_commit(branch: &str) -> Result<(String, String)> {
fn get_last_branch_commit(branch: &str, verbose: u8) -> Result<(String, String)> {
if verbose > 1 {
println!("Getting last commit on '{branch}' branch");
}
let result = Command::new("git")
.arg("log")
.args(["-n", "1"])
@ -347,6 +350,15 @@ fn clone_test262(commit: Option<&str>, verbose: u8) -> Result<()> {
let update = commit.is_none();
if Path::new(DEFAULT_TEST262_DIRECTORY).is_dir() {
let (current_commit_hash, current_commit_message) =
get_last_branch_commit("HEAD", verbose)?;
if let Some(commit) = commit {
if current_commit_hash == commit {
return Ok(());
}
}
if verbose != 0 {
println!("Fetching latest test262 commits...");
}
@ -362,20 +374,17 @@ fn clone_test262(commit: Option<&str>, verbose: u8) -> Result<()> {
);
}
let (current_commit_hash, current_commit_message) = get_last_branch_commit("HEAD")?;
if let Some(commit) = commit {
if current_commit_hash != commit {
println!("Test262 switching to commit {commit}...");
reset_test262_commit(commit, verbose)?;
}
println!("Test262 switching to commit {commit}...");
reset_test262_commit(commit, verbose)?;
return Ok(());
}
if verbose != 0 {
println!("Checking latest Test262 with current HEAD...");
}
let (latest_commit_hash, latest_commit_message) = get_last_branch_commit("origin/main")?;
let (latest_commit_hash, latest_commit_message) =
get_last_branch_commit("origin/main", verbose)?;
if current_commit_hash != latest_commit_hash {
if update {

Loading…
Cancel
Save