Skip to content
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*.j2c binary
*.jp2 binary
*.jph binary
corpus/j2k-conformance/*.toml text eol=lf
35 changes: 34 additions & 1 deletion xtask/tests/repo_lint_support/corpus_policy.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use std::{collections::BTreeSet, fs, path::Path};
use std::{collections::BTreeSet, fs, path::Path, process::Command};

use super::{assert_file_pattern_checks, repo_root, sha256_hex, FilePatternCheck};

#[test]
fn j2k_conformance_manifests_have_platform_stable_line_endings() {
let root = repo_root();
let paths = [
"corpus/j2k-conformance/encoder-ics-cpu.toml",
"corpus/j2k-conformance/encoder-ics-cuda.toml",
"corpus/j2k-conformance/encoder-ics-metal.toml",
"corpus/j2k-conformance/encoder-matrix-v1.toml",
"corpus/j2k-conformance/t803-v3.toml",
];
let output = Command::new("git")
.args(["check-attr", "eol", "--"])
.args(paths)
.current_dir(root)
.output()
.expect("inspect conformance manifest line-ending attributes");
assert!(
output.status.success(),
"git check-attr failed: {}",
String::from_utf8_lossy(&output.stderr)
);
let attributes = String::from_utf8(output.stdout).expect("git attributes are UTF-8");

for path in paths {
assert!(
attributes
.lines()
.any(|line| line == format!("{path}: eol: lf")),
"{path} must be checked out with LF bytes so evidence hashes are platform-stable"
);
}
}

#[test]
fn conformance_manifest_hashes_and_generator_cover_committed_fixtures() {
let root = repo_root();
Expand Down
Loading