Skip to content

Commit 2e3a54d

Browse files
committed
XXX Windows test hack
1 parent 9dc8005 commit 2e3a54d

File tree

4 files changed

+22
-33
lines changed

4 files changed

+22
-33
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
# macos-13 is x86; macos-14 is ARM
19-
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
19+
os: [windows-latest]
2020
cargo_flags: [""]
21-
include:
22-
- os: ubuntu-latest
23-
cargo_flags: "--all-features"
2421
runs-on: ${{ matrix.os }}
2522

2623
# TODO FIXME (aseipp): keep the timeout limit to ~15 minutes. this is long
@@ -38,40 +35,14 @@ jobs:
3835
steps:
3936
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
4037

41-
# The default version of gpg installed on the runners is a version baked in with git
42-
# which only contains the components needed by git and doesn't work for our test cases.
43-
#
44-
# This installs the latest gpg4win version, which is a variation of GnuPG built for
45-
# Windows.
46-
#
47-
# There is some issue with windows PATH max length which is what all the PATH wrangling
48-
# below is for. Please see the below link for where this fix was derived from:
49-
# https://github.com/orgs/community/discussions/24933
50-
- name: Setup GnuPG [windows]
51-
if: ${{ matrix.os == 'windows-latest' }}
52-
run: |
53-
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin"
54-
[Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine")
55-
choco install --yes gpg4win
56-
echo "C:\Program Files (x86)\Gpg4win\..\GnuPG\bin" >> $env:GITHUB_PATH
57-
58-
# The default version of openssh on windows server is quite old (8.1) and doesn't have
59-
# all the necessary signing/verification commands available (such as -Y find-principals)
60-
- name: Setup ssh-agent [windows]
61-
if: ${{ matrix.os == 'windows-latest' }}
62-
run: |
63-
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
64-
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
65-
choco install openssh --pre
66-
6738
- name: Install Rust
6839
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8
6940
with:
7041
toolchain: 1.76
7142
- name: Build
7243
run: cargo build --workspace --all-targets --verbose ${{ matrix.cargo_flags }}
7344
- name: Test
74-
run: cargo test --workspace --all-targets --verbose ${{ matrix.cargo_flags }}
45+
run: cargo test working --workspace --all-targets --verbose ${{ matrix.cargo_flags }} --no-fail-fast -- --show-output
7546
env:
7647
RUST_BACKTRACE: 1
7748

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ chrono-english = { workspace = true }
4242
clru = { workspace = true }
4343
config = { workspace = true }
4444
digest = { workspace = true }
45+
dunce = { workspace = true }
4546
either = { workspace = true }
4647
futures = { workspace = true }
4748
git2 = { workspace = true, optional = true }

lib/tests/test_local_working_copy.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ fn test_check_out_existing_file_symlink_icase_fs(victim_exists: bool) {
13451345
if victim_exists {
13461346
std::fs::write(&victim_file_path, "old").unwrap();
13471347
}
1348-
assert_eq!(workspace_root.join("parent").exists(), victim_exists);
1348+
assert_eq!(workspace_root.join("parent").try_exists().unwrap(), victim_exists);
13491349

13501350
let file_path = RepoPath::from_internal_string("PARENT");
13511351
let tree = create_tree(repo, &[(file_path, "bad")]);
@@ -1364,7 +1364,7 @@ fn test_check_out_existing_file_symlink_icase_fs(victim_exists: bool) {
13641364
if victim_exists {
13651365
assert_eq!(std::fs::read(&victim_file_path).unwrap(), b"old");
13661366
} else {
1367-
assert!(!victim_file_path.exists());
1367+
assert!(!victim_file_path.try_exists().unwrap());
13681368
}
13691369
}
13701370

@@ -1648,7 +1648,23 @@ fn test_check_out_reserved_file_path_vfat(vfat_path_str: &str, file_path_strs: &
16481648
let repo = &test_workspace.repo;
16491649
let workspace_root = test_workspace.workspace.workspace_root().to_owned();
16501650
std::fs::create_dir(workspace_root.join(".git")).unwrap();
1651+
std::fs::create_dir(workspace_root.join("..git")).unwrap();
1652+
std::fs::create_dir(workspace_root.join("...git")).unwrap();
1653+
std::fs::create_dir(workspace_root.join("....git")).unwrap();
1654+
std::fs::create_dir(workspace_root.join(".....git")).unwrap();
1655+
assert!(workspace_root.join(".jj").exists());
16511656
let is_vfat = check_vfat(&workspace_root);
1657+
for i in 0..=9 {
1658+
for name in ["GIT", "JJ"] {
1659+
let path = workspace_root.join(format!("{name}~{i}"));
1660+
eprintln!("XXX {} {}", path.display(), path.exists());
1661+
}
1662+
}
1663+
std::process::Command::new("cmd")
1664+
.args(["/c", "dir /x"])
1665+
.current_dir(dunce::simplified(&workspace_root))
1666+
.status()
1667+
.unwrap();
16521668

16531669
let vfat_disk_path = workspace_root.join(vfat_path_str);
16541670
let file_paths = file_path_strs

0 commit comments

Comments
 (0)