Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest, macOS-latest]

# Test against the oldest supported version.
# Test against beta Rust to get early warning of any problems that might occur with the upcoming Rust release.
Expand All @@ -51,13 +51,24 @@ jobs:
# Test with no features and all features.
args: ["--no-default-features", "--all-features"]
steps:
- name: Set git to use LF
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}
- if: matrix.rust == 'stable' && matrix.args == '--all-features'
- if: runner.os == 'Windows'
name: Set VCPKG root
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
- if: runner.os == 'Windows'
name: Install OpenSSL for Windows
run: vcpkg install openssl:x64-windows-static-md
- if: matrix.rust == 'stable' && matrix.args == '--all-features' && matrix.os == 'ubuntu-latest'
run: cargo clippy ${{ matrix.args }} -- -D warnings
- run: cargo build ${{ matrix.args }} --locked
- run: cargo test ${{ matrix.args }} -- --test-threads=1 2>&1
Expand Down
2 changes: 2 additions & 0 deletions src/commons/ext_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use bytes::Bytes;
use log::LevelFilter;
use rpki::repository::resources::{AsBlocks, IpBlocks};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(unix)]
use syslog::Facility;


Expand Down Expand Up @@ -182,6 +183,7 @@ where

//------------ Facility ------------------------------------------------------

#[cfg(unix)]
pub fn de_facility<'de, D>(d: D) -> Result<Facility, D::Error>
where
D: Deserializer<'de>,
Expand Down
11 changes: 7 additions & 4 deletions src/commons/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ fn derive_uri(
None => format!("rsync://{rel_string}"),
};

#[cfg(not(unix))]
let uri_string = uri_string.replace("\\", "/");

let uri = uri::Rsync::from_str(&uri_string)
.map_err(|_| Error::UnsupportedFileName(uri_string))?;
Ok(uri)
Expand Down Expand Up @@ -568,19 +571,19 @@ mod tests {
fn should_scan_disk() {
test::test_under_tmp(|base_dir| {
let file_1 = CurrentFile::new(
test::rsync("rsync://host:10873/module/alice/file1.txt"),
test::rsync("rsync://host/module/alice/file1.txt"),
&Bytes::from("content 1"),
);
let file_2 = CurrentFile::new(
test::rsync("rsync://host:10873/module/alice/file2.txt"),
test::rsync("rsync://host/module/alice/file2.txt"),
&Bytes::from("content 2"),
);
let file_3 = CurrentFile::new(
test::rsync("rsync://host:10873/module/alice/sub/file1.txt"),
test::rsync("rsync://host/module/alice/sub/file1.txt"),
&Bytes::from("content sub file"),
);
let file_4 = CurrentFile::new(
test::rsync("rsync://host:10873/module/bob/file.txt"),
test::rsync("rsync://host/module/bob/file.txt"),
&Bytes::from("content"),
);

Expand Down
7 changes: 7 additions & 0 deletions src/commons/storage/backends/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ impl Store {
let path = PathBuf::from(format!(
"{}{}", uri.host_str().unwrap_or_default(), uri.path()
));

#[cfg(windows)]
let path = path.to_string_lossy()
.strip_prefix('/')
.map(|s| PathBuf::from(s))
.unwrap_or(path);

let root = path.join(namespace.as_str());
let tmp = path.join(TMP_FILE_DIR);
let mut locks = path.join(LOCK_FILE_DIR);
Expand Down
6 changes: 5 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1669,13 +1669,17 @@ impl Config {
match self.log_type {
LogType::File => self.file_logger(),
LogType::Stderr => self.stderr_logger(),
#[cfg(unix)]
LogType::Syslog => {
let facility = Facility::from_str(&self.syslog_facility)
.map_err(|_| {
ConfigError::other("Invalid syslog_facility")
})?;
self.syslog_logger(facility)
}
},
#[cfg(not(unix))]
LogType::Syslog =>
Err(ConfigError::other("syslog not support on non-unix")),
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/upgrades/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,8 +1588,11 @@ mod tests {
"test-resources/status_store/migration-0.9.5/";
let temp_dir = tempdir().unwrap();
copy_folder(source_dir_path_str, &temp_dir);
let temp_dir_str = &temp_dir.path().to_str().unwrap();
Comment thread
Koenvh1 marked this conversation as resolved.
Outdated
#[cfg(windows)]
let temp_dir_str = format!("/{}", temp_dir_str);
let source_dir_url = Url::parse(
&format!("local://{}", &temp_dir.path().to_str().unwrap()))
&format!("local://{}", temp_dir_str))
.unwrap();

let source_store =
Expand Down
7 changes: 6 additions & 1 deletion tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ impl TestConfig {

pub fn file_storage() -> Self {
let data_dir = TempDir::new().unwrap();
let uri = data_dir.path().to_string_lossy();

#[cfg(windows)]
let uri = format!("/{}", uri.replace("\\", "/"));

Self::new(
Url::parse(
&format!("local://{}/data/", data_dir.path().display())
&format!("local://{}/data/", uri)
).unwrap() ,
data_dir,
)
Expand Down
1 change: 1 addition & 0 deletions tests/functional_old_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn untar_file(tar_path: &str, dst: impl AsRef<path::Path>) {
/// from v0.14.5, even as a TA. If it does not, then we might have a problem.
///
/// The test data contains ROA, ASPA, BGPsec, and child objects.
#[cfg(unix)]
#[tokio::test]
async fn functional_old_data() {
let (mut config, tempdir) = common::TestConfig::file_storage()
Expand Down
Loading