Skip to content
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

Prevent test262 repository update if not needed #3386

Merged
merged 1 commit into from
Oct 15, 2023
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
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
25 changes: 17 additions & 8 deletions boa_tester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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...");
}
Expand All @@ -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 {
Expand Down