mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-26 22:30:11 +00:00
* feat(testkit): install and configure Claude Code, Codex and opencode against a gateway Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * refactor(testkit): derive targets from target-lexicon and split agents behind a trait Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * refactor(testkit): group sources into agent and install folders Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * feat(testkit): split agents into install, configure and drive with semver-aware launch Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * style(testkit): drop a needless borrow Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Yujong Lee <yujong@berri.ai> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
69 lines
1.7 KiB
Rust
69 lines
1.7 KiB
Rust
use target_lexicon::{Architecture, Environment, OperatingSystem, Triple};
|
|
|
|
use crate::Error;
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum Os {
|
|
Macos,
|
|
Linux,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum Arch {
|
|
Aarch64,
|
|
X86_64,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub struct Target {
|
|
pub os: Os,
|
|
pub arch: Arch,
|
|
pub musl: bool,
|
|
}
|
|
|
|
impl Target {
|
|
pub fn host() -> Result<Self, Error> {
|
|
Self::try_from(&Triple::host())
|
|
}
|
|
|
|
pub(crate) const fn os_name(self) -> &'static str {
|
|
match self.os {
|
|
Os::Macos => "darwin",
|
|
Os::Linux => "linux",
|
|
}
|
|
}
|
|
|
|
pub(crate) const fn arch_name(self) -> &'static str {
|
|
match self.arch {
|
|
Arch::Aarch64 => "arm64",
|
|
Arch::X86_64 => "x64",
|
|
}
|
|
}
|
|
|
|
pub(crate) const fn musl_suffix(self) -> &'static str {
|
|
if self.musl { "-musl" } else { "" }
|
|
}
|
|
}
|
|
|
|
impl TryFrom<&Triple> for Target {
|
|
type Error = Error;
|
|
|
|
fn try_from(triple: &Triple) -> Result<Self, Error> {
|
|
let unsupported = || Error::UnsupportedTarget(triple.to_string());
|
|
let os = match triple.operating_system {
|
|
OperatingSystem::Darwin(_) | OperatingSystem::MacOSX(_) => Os::Macos,
|
|
OperatingSystem::Linux => Os::Linux,
|
|
_ => return Err(unsupported()),
|
|
};
|
|
let arch = match triple.architecture {
|
|
Architecture::Aarch64(_) => Arch::Aarch64,
|
|
Architecture::X86_64 => Arch::X86_64,
|
|
_ => return Err(unsupported()),
|
|
};
|
|
Ok(Self {
|
|
os,
|
|
arch,
|
|
musl: triple.environment == Environment::Musl,
|
|
})
|
|
}
|
|
}
|