sit: fix tests on aarch64

As we found out in #40032, sit tests won't pass on
aarch64. The problem seems to be related to
`create_dir` not returning an error if the directory
already exists, happening specifically on aarch64+debug
(not aarch64+release)

This update injects a patch for tests that will also
be included in subsequent versions of SIT.
This commit is contained in:
Yurii Rashkovskii 2018-05-07 13:33:51 -07:00
parent 17fe52a6c7
commit 783d547bdd
No known key found for this signature in database
GPG key ID: 1D60D7CFD80845FF
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,17 @@
diff --git a/sit-core/src/repository.rs b/sit-core/src/repository.rs
index ebd357d..074dcc9 100644
--- a/sit-core/src/repository.rs
+++ b/sit-core/src/repository.rs
@@ -305,6 +305,12 @@ impl Repository {
let id: String = name.into();
let mut path = self.items_path.clone();
path.push(&id);
+ #[cfg(all(debug_assertions, target_arch = "aarch64"))] {
+ use std::io;
+ if path.is_dir() {
+ return Err(io::Error::from_raw_os_error(17).into()); // 17 is EEXIST
+ }
+ }
fs::create_dir(path)?;
let id = OsString::from(id);
Ok(Item {

View file

@ -15,6 +15,8 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "102haqix13nwcncng1s8qkw68spn6fhh3vysk2nbahw6f78zczqg";
patches = [ ./aarch64-eexist.patch ];
meta = with stdenv.lib; {
description = "Serverless Information Tracker";
homepage = https://sit.sh/;