mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
fix(protocol): make local image test Bazel-friendly (#11799)
Fixes Bazel build failure in //codex-rs/protocol:protocol-unit-tests. The test used include_bytes! to read a PNG from codex-core assets; Cargo can read it, but Bazel sandboxing can't, so the crate fails to compile. This change inlines a tiny valid PNG in the test to keep it hermetic. Related regression: #10590 (cc: @charley-oai)
This commit is contained in:
1 parent
6b466df146
commit
067f8b1be0
1 file changed
+8
-4
@@ -1617,10 +1617,14 @@ mod tests {
|
|||||||
let image_url = "data:image/png;base64,abc".to_string();
|
let image_url = "data:image/png;base64,abc".to_string();
|
||||||
let dir = tempdir()?;
|
let dir = tempdir()?;
|
||||||
let local_path = dir.path().join("local.png");
|
let local_path = dir.path().join("local.png");
|
||||||
let png_bytes = include_bytes!(
|
// A tiny valid PNG (1x1) so this test doesn't depend on cross-crate file paths, which
|
||||||
"../../core/src/skills/assets/samples/skill-creator/assets/skill-creator.png"
|
// break under Bazel sandboxing.
|
||||||
);
|
const TINY_PNG_BYTES: &[u8] = &[
|
||||||
std::fs::write(&local_path, png_bytes.as_slice())?;
|
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1,
|
||||||
|
8, 6, 0, 0, 0, 31, 21, 196, 137, 0, 0, 0, 11, 73, 68, 65, 84, 120, 156, 99, 96, 0, 2,
|
||||||
|
0, 0, 5, 0, 1, 122, 94, 171, 63, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130,
|
||||||
|
];
|
||||||
|
std::fs::write(&local_path, TINY_PNG_BYTES)?;
|
||||||
|
|
||||||
let item = ResponseInputItem::from(vec![
|
let item = ResponseInputItem::from(vec![
|
||||||
UserInput::Image {
|
UserInput::Image {
|
||||||
|
|||||||
Reference in new issue
Block a user