repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/cli.rs | tests/cli.rs | use std::process::Command;
use assert_cmd::{cargo, prelude::*};
use clap::{ValueEnum, crate_name, crate_version};
use clap_complete::Shell;
mod fixtures;
use crate::fixtures::Error;
#[test]
/// Show help and exit.
fn help_shows() -> Result<(), Error> {
Command::new(cargo::cargo_bin!("miniserve"))
.arg("... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/rm_files.rs | tests/rm_files.rs | mod fixtures;
use assert_fs::fixture::TempDir;
use fixtures::{Error, TestServer, server, tmpdir};
use percent_encoding::utf8_percent_encode;
use reqwest::StatusCode;
use reqwest::blocking::Client;
use rstest::rstest;
use std::path::{Component, Path};
use url::Url;
use crate::fixtures::{DEEPLY_NESTED_FILE, DIRECTORIES... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/header.rs | tests/header.rs | use rstest::rstest;
mod fixtures;
use crate::fixtures::{Error, server};
#[rstest]
#[case(vec!["x-info: 123".to_string()])]
#[case(vec!["x-info1: 123".to_string(), "x-info2: 345".to_string()])]
fn custom_header_set(#[case] headers: Vec<String>) -> Result<(), Error> {
let server = server(headers.iter().flat_map(|h... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/navigation.rs | tests/navigation.rs | use std::path::{Component, Path};
use std::process::{Command, Stdio};
use pretty_assertions::{assert_eq, assert_ne};
use rstest::rstest;
use select::document::Document;
mod fixtures;
mod utils;
use crate::fixtures::{DEEPLY_NESTED_FILE, DIRECTORIES, Error, TestServer, server};
use crate::utils::{get_link_from_text, g... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/api.rs | tests/api.rs | use std::collections::HashMap;
use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
use reqwest::{StatusCode, blocking::Client};
use rstest::rstest;
mod fixtures;
use crate::fixtures::{DIRECTORIES, Error, TestServer, server};
/// Test that we can get dir size for plain paths as well as percent-encoded pat... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/webdav.rs | tests/webdav.rs | use std::process::Command;
use assert_cmd::{cargo, prelude::*};
use assert_fs::TempDir;
use predicates::str::contains;
use reqwest::{Method, blocking::Client};
use reqwest_dav::{
ClientBuilder as DavClientBuilder,
list_cmd::{ListEntity, ListFile, ListFolder},
};
use rstest::rstest;
mod fixtures;
use crate::f... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/auth.rs | tests/auth.rs | use pretty_assertions::assert_eq;
use reqwest::{StatusCode, blocking::Client};
use rstest::rstest;
use select::{document::Document, predicate::Text};
mod fixtures;
use crate::fixtures::{Error, FILES, server};
#[rstest]
#[case("testuser:testpassword", "testuser", "testpassword")]
#[case(
"testuser:sha256:9f735e0d... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/raw.rs | tests/raw.rs | use pretty_assertions::assert_eq;
use reqwest::blocking::Client;
use rstest::rstest;
use select::{
document::Document,
predicate::{Class, Name},
};
mod fixtures;
use crate::fixtures::{Error, TestServer, server};
/// The footer displays the correct wget command to download the folder recursively
// This test ... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/upload_files.rs | tests/upload_files.rs | use std::fs::create_dir_all;
use std::path::Path;
use assert_fs::fixture::TempDir;
use reqwest::blocking::{Client, multipart};
use reqwest::header::HeaderMap;
use rstest::rstest;
use select::document::Document;
use select::predicate::{Attr, Text};
mod fixtures;
use crate::fixtures::{Error, TestServer, server, tmpdir... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/serve_request.rs | tests/serve_request.rs | use std::process::{Command, Stdio};
use std::thread::sleep;
use std::time::Duration;
use assert_cmd::cargo;
use assert_fs::fixture::TempDir;
use fixtures::BROKEN_SYMLINK;
use regex::Regex;
use reqwest::StatusCode;
use rstest::rstest;
use select::{document::Document, node::Node, predicate::Attr};
mod fixtures;
use cr... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/fixtures/mod.rs | tests/fixtures/mod.rs | use std::io::{BufRead, BufReader};
use std::process::{Child, Command, Stdio};
use std::thread;
use std::thread::sleep;
use std::time::{Duration, Instant};
use assert_cmd::cargo;
use assert_fs::fixture::TempDir;
use assert_fs::prelude::*;
use port_check::free_local_port;
use reqwest::Url;
use rstest::fixture;
/// Erro... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
svenstaro/miniserve | https://github.com/svenstaro/miniserve/blob/308795e98c0347a37870f3c42524bbe21dab9b5c/tests/utils/mod.rs | tests/utils/mod.rs | use select::document::Document;
use select::node::Node;
use select::predicate::Name;
use select::predicate::Predicate;
/// Return the href attribute content for the closest anchor found by `text`.
pub fn get_link_from_text(document: &Document, text: &str) -> Option<String> {
let a_elem = document
.find(Nam... | rust | MIT | 308795e98c0347a37870f3c42524bbe21dab9b5c | 2026-01-04T15:51:38.296723Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/lib.rs | crates/sshx/src/lib.rs | //! Library code for the sshx command-line client application.
//!
//! This crate does not forbid use of unsafe code because it needs to interact
//! with operating-system APIs to access pseudoterminal (PTY) devices.
#![deny(unsafe_code)]
#![warn(missing_docs)]
pub mod controller;
pub mod encrypt;
pub mod runner;
pub... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/runner.rs | crates/sshx/src/runner.rs | //! Defines tasks that control the behavior of a single shell in the client.
use anyhow::Result;
use encoding_rs::{CoderResult, UTF_8};
use sshx_core::proto::{client_update::ClientMessage, TerminalData};
use sshx_core::Sid;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
sync::mpsc,
};
use crate::encrypt::Enc... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/controller.rs | crates/sshx/src/controller.rs | //! Network gRPC client allowing server control of terminals.
use std::collections::HashMap;
use std::pin::pin;
use anyhow::{Context, Result};
use sshx_core::proto::{
client_update::ClientMessage, server_update::ServerMessage,
sshx_service_client::SshxServiceClient, ClientUpdate, CloseRequest, NewShell, OpenR... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/terminal.rs | crates/sshx/src/terminal.rs | //! Terminal driver, which communicates with a shell subprocess through PTY.
#![allow(unsafe_code)]
cfg_if::cfg_if! {
if #[cfg(unix)] {
mod unix;
pub use unix::{get_default_shell, Terminal};
} else if #[cfg(windows)] {
mod windows;
pub use windows::{get_default_shell, Terminal}... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/main.rs | crates/sshx/src/main.rs | use std::process::ExitCode;
use ansi_term::Color::{Cyan, Fixed, Green};
use anyhow::Result;
use clap::Parser;
use sshx::{controller::Controller, runner::Runner, terminal::get_default_shell};
use tokio::signal;
use tracing::error;
/// A secure web-based, collaborative terminal.
#[derive(Parser, Debug)]
#[clap(author, ... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/encrypt.rs | crates/sshx/src/encrypt.rs | //! Encryption of byte streams based on a random key.
use aes::cipher::{KeyIvInit, StreamCipher, StreamCipherSeek};
type Aes128Ctr64BE = ctr::Ctr64BE<aes::Aes128>;
// Note: The KDF salt is public, as it needs to be used from the web client. It
// only exists to make rainbow table attacks less likely.
const SALT: &st... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/terminal/unix.rs | crates/sshx/src/terminal/unix.rs | use std::convert::Infallible;
use std::env;
use std::ffi::{CStr, CString};
use std::os::fd::{AsRawFd, RawFd};
use std::pin::Pin;
use std::task::{Context, Poll};
use anyhow::Result;
use close_fds::CloseFdsBuilder;
use nix::errno::Errno;
use nix::libc::{login_tty, TIOCGWINSZ, TIOCSWINSZ};
use nix::pty::{self, Winsize};
... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/src/terminal/windows.rs | crates/sshx/src/terminal/windows.rs | use std::pin::Pin;
use std::process::Command;
use std::task::Context;
use std::task::Poll;
use anyhow::Result;
use pin_project::{pin_project, pinned_drop};
use tokio::fs::{self, File};
use tokio::io::{self, AsyncRead, AsyncWrite};
use tracing::instrument;
/// Returns the default shell on this system.
///
/// For Wind... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx/examples/stdin_client.rs | crates/sshx/examples/stdin_client.rs | use std::io::Read;
use std::sync::Arc;
use std::thread;
use anyhow::Result;
use sshx::terminal::{get_default_shell, Terminal};
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::signal;
use tokio::sync::mpsc;
use tracing::{error, info, trace};
#[tokio::main]
async fn main() -> Result<()> {
tracing_sub... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-core/build.rs | crates/sshx-core/build.rs | use std::{env, path::PathBuf};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("sshx.bin");
tonic_build::configure()
.file_descriptor_set_path(descriptor_path)
.bytes(["."])
.compile_protos(&["proto/sshx.proto"... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-core/src/lib.rs | crates/sshx-core/src/lib.rs | //! The core crate for shared code used in the sshx application.
#![forbid(unsafe_code)]
#![warn(missing_docs)]
use std::fmt::Display;
use std::sync::atomic::{AtomicU32, Ordering};
use serde::{Deserialize, Serialize};
/// Protocol buffer and gRPC definitions, automatically generated by Tonic.
#[allow(missing_docs, ... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/grpc.rs | crates/sshx-server/src/grpc.rs | //! Defines gRPC routes and application request logic.
use std::sync::Arc;
use std::time::{Duration, SystemTime};
use base64::prelude::{Engine as _, BASE64_STANDARD};
use hmac::Mac;
use sshx_core::proto::{
client_update::ClientMessage, server_update::ServerMessage, sshx_service_server::SshxService,
ClientUpda... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/lib.rs | crates/sshx-server/src/lib.rs | //! The sshx server, which coordinates terminal sharing.
//!
//! Requests are communicated to the server via gRPC (for command-line sharing
//! clients) and WebSocket connections (for web listeners). The server is built
//! using a hybrid Hyper service, split between a Tonic gRPC handler and an Axum
//! web listener.
/... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/session.rs | crates/sshx-server/src/session.rs | //! Core logic for sshx sessions, independent of message transport.
use std::collections::HashMap;
use std::ops::DerefMut;
use std::sync::Arc;
use anyhow::{bail, Context, Result};
use bytes::Bytes;
use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
use sshx_core::{
proto::{server_update::ServerMessage, SequenceN... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/state.rs | crates/sshx-server/src/state.rs | //! Stateful components of the server, managing multiple sessions.
use std::pin::pin;
use std::sync::Arc;
use std::time::Duration;
use anyhow::Result;
use dashmap::DashMap;
use hmac::{Hmac, Mac as _};
use sha2::Sha256;
use sshx_core::rand_alphanumeric;
use tokio::time;
use tokio_stream::StreamExt;
use tracing::error;... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/utils.rs | crates/sshx-server/src/utils.rs | //! Utility functions shared among server logic.
use std::fmt::Debug;
use std::future::Future;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use tokio::sync::Notify;
/// A cloneable structure that handles shutdown signals.
#[derive(Clone)]
pub struct Shutdown {
inner: Arc<(AtomicBool, Notify... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/listen.rs | crates/sshx-server/src/listen.rs | use std::{fmt::Debug, future::Future, sync::Arc};
use anyhow::Result;
use axum::body::Body;
use axum::serve::Listener;
use http::{header::CONTENT_TYPE, Request};
use sshx_core::proto::{sshx_service_server::SshxServiceServer, FILE_DESCRIPTOR_SET};
use tonic::service::Routes as TonicRoutes;
use tower::{make::Shared, ste... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/web.rs | crates/sshx-server/src/web.rs | //! HTTP and WebSocket handlers for the sshx web interface.
use std::sync::Arc;
use axum::routing::{any, get_service};
use axum::Router;
use tower_http::services::{ServeDir, ServeFile};
use crate::ServerState;
pub mod protocol;
mod socket;
/// Returns the web application server, routed with Axum.
pub fn app() -> R... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/main.rs | crates/sshx-server/src/main.rs | use std::{
net::{IpAddr, SocketAddr},
process::ExitCode,
};
use anyhow::Result;
use clap::Parser;
use sshx_server::{Server, ServerOptions};
use tokio::signal::unix::{signal, SignalKind};
use tracing::{error, info};
/// The sshx server CLI interface.
#[derive(Parser, Debug)]
#[clap(author, version, about, long... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/state/mesh.rs | crates/sshx-server/src/state/mesh.rs | //! Storage and distributed communication.
use std::{pin::pin, sync::Arc, time::Duration};
use anyhow::Result;
use redis::AsyncCommands;
use tokio::time;
use tokio_stream::{Stream, StreamExt};
use tracing::error;
use crate::session::Session;
/// Interval for syncing the latest session state into persistent storage.... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/session/snapshot.rs | crates/sshx-server/src/session/snapshot.rs | //! Snapshot and restore sessions from serialized state.
use std::collections::BTreeMap;
use anyhow::{ensure, Context, Result};
use prost::Message;
use sshx_core::{
proto::{SerializedSession, SerializedShell},
Sid, Uid,
};
use super::{Metadata, Session, State};
use crate::web::protocol::WsWinsize;
/// Persi... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/web/protocol.rs | crates/sshx-server/src/web/protocol.rs | //! Serializable types sent and received by the web server.
use bytes::Bytes;
use serde::{Deserialize, Serialize};
use sshx_core::{Sid, Uid};
/// Real-time message conveying the position and size of a terminal.
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/src/web/socket.rs | crates/sshx-server/src/web/socket.rs | use std::collections::HashSet;
use std::sync::Arc;
use anyhow::{Context, Result};
use axum::extract::{
ws::{CloseFrame, Message, WebSocket, WebSocketUpgrade},
Path, State,
};
use axum::response::IntoResponse;
use bytes::Bytes;
use futures_util::SinkExt;
use sshx_core::proto::{server_update::ServerMessage, NewS... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/tests/simple.rs | crates/sshx-server/tests/simple.rs | use anyhow::Result;
use sshx::encrypt::Encrypt;
use sshx_core::proto::*;
use crate::common::*;
pub mod common;
#[tokio::test]
async fn test_rpc() -> Result<()> {
let server = TestServer::new().await;
let mut client = server.grpc_client().await;
let req = OpenRequest {
origin: "sshx.io".into(),
... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/tests/snapshot.rs | crates/sshx-server/tests/snapshot.rs | use std::sync::Arc;
use anyhow::Result;
use sshx::{controller::Controller, runner::Runner};
use sshx_core::{Sid, Uid};
use sshx_server::{
session::Session,
web::protocol::{WsClient, WsWinsize},
};
use crate::common::*;
pub mod common;
#[tokio::test]
async fn test_basic_restore() -> Result<()> {
let serv... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/tests/with_client.rs | crates/sshx-server/tests/with_client.rs | use anyhow::{Context, Result};
use sshx::{controller::Controller, encrypt::Encrypt, runner::Runner};
use sshx_core::{
proto::{server_update::ServerMessage, NewShell, TerminalInput},
Sid, Uid,
};
use sshx_server::web::protocol::{WsClient, WsWinsize};
use tokio::time::{self, Duration};
use crate::common::*;
pub... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
ekzhang/sshx | https://github.com/ekzhang/sshx/blob/dd42496be83da6a7cbb963aee54ba9402f0ddd98/crates/sshx-server/tests/common/mod.rs | crates/sshx-server/tests/common/mod.rs | use std::collections::{BTreeMap, HashMap};
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use anyhow::{ensure, Result};
use axum::serve::ListenerExt;
use futures_util::{SinkExt, StreamExt};
use http::StatusCode;
use sshx::encrypt::Encrypt;
use sshx_core::proto::sshx_service_client::SshxServiceC... | rust | MIT | dd42496be83da6a7cbb963aee54ba9402f0ddd98 | 2026-01-04T15:52:13.584130Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/jobs.rs | src/ci/citool/src/jobs.rs | #[cfg(test)]
mod tests;
use std::collections::{BTreeMap, HashSet};
use anyhow::{Context as _, anyhow};
use serde_yaml::Value;
use crate::GitHubContext;
use crate::utils::load_env_var;
/// Representation of a job loaded from the `src/ci/github-actions/jobs.yml` file.
#[derive(serde::Deserialize, Debug, Clone)]
#[ser... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/datadog.rs | src/ci/citool/src/datadog.rs | use anyhow::Context;
use crate::utils::load_env_var;
/// Uploads a custom CI pipeline metric to Datadog.
/// Expects to be executed from within the context of a GitHub Actions job.
pub fn upload_datadog_metric(name: &str, value: f64) -> anyhow::Result<()> {
let datadog_api_key = load_env_var("DATADOG_API_KEY")?;
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/analysis.rs | src/ci/citool/src/analysis.rs | use std::collections::{BTreeMap, HashMap, HashSet};
use std::fmt::Debug;
use std::time::Duration;
use build_helper::metrics::{
BuildStep, JsonRoot, TestOutcome, TestSuite, TestSuiteMetadata, escape_step_name,
format_build_steps,
};
use crate::github::JobInfoResolver;
use crate::metrics::{JobMetrics, JobName, ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/utils.rs | src/ci/citool/src/utils.rs | use std::borrow::Cow;
use std::convert::AsRef;
use std::path::Path;
use std::process::Command;
use anyhow::Context;
pub fn load_env_var(name: &str) -> anyhow::Result<String> {
std::env::var(name).with_context(|| format!("Cannot find environment variable `{name}`"))
}
pub fn read_to_string<P: AsRef<Path>>(path: P... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/cpu_usage.rs | src/ci/citool/src/cpu_usage.rs | use std::path::Path;
/// Loads CPU usage records from a CSV generated by the `src/ci/scripts/collect-cpu-stats.sh`
/// script.
pub fn load_cpu_usage(path: &Path) -> anyhow::Result<Vec<f64>> {
let reader = csv::ReaderBuilder::new().flexible(true).from_path(path)?;
let mut entries = vec![];
for row in reade... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/github.rs | src/ci/citool/src/github.rs | use std::collections::HashMap;
use anyhow::Context;
use build_helper::metrics::{CiMetadata, JsonRoot};
pub struct GitHubClient;
impl GitHubClient {
fn get_workflow_run_jobs(
&self,
repo: &str,
workflow_run_id: u64,
) -> anyhow::Result<Vec<GitHubJob>> {
let req = ureq::get(form... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/test_dashboard.rs | src/ci/citool/src/test_dashboard.rs | use std::collections::{BTreeMap, HashMap};
use std::fs::File;
use std::io::BufWriter;
use std::path::{Path, PathBuf};
use askama::Template;
use build_helper::metrics::{TestOutcome, TestSuiteMetadata};
use crate::jobs::JobDatabase;
use crate::metrics::{JobMetrics, JobName, download_auto_job_metrics, get_test_suites};
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/main.rs | src/ci/citool/src/main.rs | mod analysis;
mod cpu_usage;
mod datadog;
mod github;
mod jobs;
mod metrics;
mod test_dashboard;
mod utils;
use std::collections::{BTreeMap, HashMap};
use std::path::{Path, PathBuf};
use std::process::Command;
use analysis::output_bootstrap_stats;
use anyhow::Context;
use clap::Parser;
use jobs::JobDatabase;
use serd... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/metrics.rs | src/ci/citool/src/metrics.rs | use std::collections::HashMap;
use std::path::{Path, PathBuf};
use anyhow::Context;
use build_helper::metrics::{JsonNode, JsonRoot, TestSuite};
use crate::jobs::JobDatabase;
pub type JobName = String;
pub fn get_test_suites(metrics: &JsonRoot) -> Vec<&TestSuite> {
fn visit_test_suites<'a>(nodes: &'a [JsonNode],... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/src/jobs/tests.rs | src/ci/citool/src/jobs/tests.rs | use std::collections::BTreeMap;
use std::path::Path;
use super::Job;
use crate::jobs::{JobDatabase, load_job_db};
use crate::{DOCKER_DIRECTORY, JOBS_YML_PATH, utils};
#[test]
fn lookup_job_pattern() {
let db = load_job_db(
r#"
envs:
pr:
try:
auto:
pr:
try:
auto:
- name: dist-a
os: ubuntu
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/ci/citool/tests/jobs.rs | src/ci/citool/tests/jobs.rs | use std::process::{Command, Stdio};
const TEST_JOBS_YML_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/test-jobs.yml");
#[test]
fn auto_jobs() {
let stdout = get_matrix("push", "commit", "refs/heads/auto");
insta::assert_snapshot!(stdout, @r#"
jobs=[{"name":"aarch64-gnu","full_name":"auto - aarc... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/replace-version-placeholder/src/main.rs | src/tools/replace-version-placeholder/src/main.rs | use std::path::PathBuf;
use tidy::{t, walk};
pub const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION";
fn main() {
let root_path: PathBuf = std::env::args_os().nth(1).expect("need path to root of repo").into();
let version_path = root_path.join("src").join("version");
let version_str = t!(std::fs::r... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/tier-check/src/main.rs | src/tools/tier-check/src/main.rs | //! This is a script for validating the platform support page in the rustc book.
//!
//! The script takes two arguments, the path to the Platform Support source
//! page, and the second argument is the path to `rustc`.
use std::collections::HashSet;
fn main() {
let mut args = std::env::args().skip(1);
let src... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/build-manifest/build.rs | src/tools/build-manifest/build.rs | use std::fmt::Write;
use std::path::PathBuf;
use std::process::{Command, Stdio};
#[derive(Default, Debug)]
pub(crate) struct RustcTargets {
/// Targets with host tool artifacts.
pub(crate) hosts: Vec<String>,
/// All targets we distribute some artifacts for (superset of `hosts`).
pub(crate) targets: V... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/build-manifest/src/manifest.rs | src/tools/build-manifest/src/manifest.rs | use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use serde::{Serialize, Serializer};
use crate::Builder;
use crate::versions::PkgType;
#[derive(Serialize)]
#[serde(rename_all = "kebab-case")]
pub(crate) struct Manifest {
pub(crate) manifest_version: String,
pub(crate) date: String,
pub(cra... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/build-manifest/src/checksum.rs | src/tools/build-manifest/src/checksum.rs | use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use std::time::Instant;
use rayon::prelude::*;
use sha2::{Digest, Sha256};
use crate::manifest::{FileHash, Manifest};
pub(crate) struct Checksums {
cac... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/build-manifest/src/main.rs | src/tools/build-manifest/src/main.rs | #![doc = include_str!("../README.md")]
mod checksum;
mod manifest;
mod versions;
use std::collections::{BTreeMap, HashSet};
use std::path::{Path, PathBuf};
use std::{env, fs};
use crate::checksum::Checksums;
use crate::manifest::{Component, Manifest, Package, Rename, Target};
use crate::versions::{PkgType, Versions}... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/build-manifest/src/versions.rs | src/tools/build-manifest/src/versions.rs | use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use anyhow::Error;
use flate2::read::GzDecoder;
use tar::Archive;
use xz2::read::XzDecoder;
const DEFAULT_TARGET: &str = "x86_64-unknown-linux-gnu";
macro_rules! pkg_type {
( $($variant:ident = $component:literal... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/parser.rs | src/tools/coverage-dump/src/parser.rs | use anyhow::ensure;
pub(crate) struct Parser<'a> {
rest: &'a [u8],
}
impl<'a> Parser<'a> {
pub(crate) fn new(input: &'a [u8]) -> Self {
Self { rest: input }
}
pub(crate) fn ensure_empty(self) -> anyhow::Result<()> {
ensure!(self.rest.is_empty(), "unparsed bytes: 0x{:02x?}", self.rest)... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/covfun.rs | src/tools/coverage-dump/src/covfun.rs | use std::collections::HashMap;
use std::fmt::{self, Debug, Write as _};
use std::sync::LazyLock;
use anyhow::{Context, anyhow, bail, ensure};
use itertools::Itertools;
use regex::Regex;
use crate::covmap::FilenameTables;
use crate::llvm_utils::unescape_llvm_string_contents;
use crate::parser::Parser;
#[cfg(test)]
mo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/prf_names.rs | src/tools/coverage-dump/src/prf_names.rs | use std::collections::HashMap;
use std::sync::OnceLock;
use regex::Regex;
use crate::llvm_utils::{truncated_md5, unescape_llvm_string_contents};
use crate::parser::Parser;
/// Scans through the contents of an LLVM IR assembly file to find `__llvm_prf_names`
/// entries, decodes them, and creates a table that maps na... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/covmap.rs | src/tools/coverage-dump/src/covmap.rs | use std::collections::HashMap;
use std::sync::LazyLock;
use anyhow::{Context, ensure};
use regex::Regex;
use crate::llvm_utils::{truncated_md5, unescape_llvm_string_contents};
use crate::parser::Parser;
#[derive(Debug, Default)]
pub(crate) struct FilenameTables {
map: HashMap<u64, Vec<String>>,
}
impl FilenameT... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/llvm_utils.rs | src/tools/coverage-dump/src/llvm_utils.rs | use std::borrow::Cow;
use std::sync::OnceLock;
use anyhow::{anyhow, ensure};
use regex::bytes;
use crate::parser::Parser;
#[cfg(test)]
mod tests;
/// Given the raw contents of a string literal in LLVM IR assembly, decodes any
/// backslash escapes and returns a vector containing the resulting byte string.
pub(crate... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/main.rs | src/tools/coverage-dump/src/main.rs | mod covfun;
mod covmap;
mod llvm_utils;
mod parser;
mod prf_names;
fn main() -> anyhow::Result<()> {
use anyhow::Context as _;
let args = std::env::args().collect::<Vec<_>>();
// The coverage-dump tool already needs `rustc_demangle` in order to read
// coverage metadata, so it's very easy to also hav... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/covfun/tests.rs | src/tools/coverage-dump/src/covfun/tests.rs | use super::{CovfunLineData, parse_covfun_line};
/// Integers in LLVM IR are not inherently signed/unsigned, and the text format tends
/// to emit them in signed form, so this helper function converts `i64` to `u64`.
fn as_u64(x: i64) -> u64 {
x as u64
}
#[test]
fn parse_covfun_line_data() {
struct Case {
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/coverage-dump/src/llvm_utils/tests.rs | src/tools/coverage-dump/src/llvm_utils/tests.rs | use super::unescape_llvm_string_contents;
// Tests for `unescape_llvm_string_contents`:
#[test]
fn unescape_empty() {
assert_eq!(unescape_llvm_string_contents(""), &[]);
}
#[test]
fn unescape_noop() {
let input = "The quick brown fox jumps over the lazy dog.";
assert_eq!(unescape_llvm_string_contents(inp... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/generate-copyright/src/cargo_metadata.rs | src/tools/generate-copyright/src/cargo_metadata.rs | //! Gets metadata about a workspace from Cargo
use std::collections::BTreeMap;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
/// Describes how this module can fail
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("I/O Error: {0:?}")]
Io(#[from] std::io::Error),
#[error("Failed get output... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/generate-copyright/src/main.rs | src/tools/generate-copyright/src/main.rs | use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use anyhow::Error;
use askama::Template;
mod cargo_metadata;
/// The entry point to the binary.
///
/// You should probably let `bootstrap` execute this program instead of running
/// it directly. It assumes that the current working directory is the roo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/collect-license-metadata/src/licenses.rs | src/tools/collect-license-metadata/src/licenses.rs | use std::collections::HashMap;
const COPYRIGHT_PREFIXES: &[&str] = &["SPDX-FileCopyrightText:", "Copyright", "(c)", "(C)", "©"];
pub(crate) struct LicensesInterner {
by_id: Vec<License>,
by_struct: HashMap<License, usize>,
}
impl LicensesInterner {
pub(crate) fn new() -> Self {
LicensesInterner {... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/collect-license-metadata/src/main.rs | src/tools/collect-license-metadata/src/main.rs | mod licenses;
mod path_tree;
mod reuse;
use std::path::PathBuf;
use anyhow::{Context, Error};
use similar::{ChangeTag, TextDiff};
use crate::licenses::LicensesInterner;
fn diff_text(expected: &str, actual: &str) {
for change in TextDiff::from_lines(expected, actual).iter_all_changes() {
let sign = match... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/collect-license-metadata/src/reuse.rs | src/tools/collect-license-metadata/src/reuse.rs | use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::Instant;
use anyhow::Error;
use crate::licenses::{License, LicenseId, LicensesInterner};
pub(crate) fn collect(
reuse_exe: &Path,
interner: &mut LicensesInterner,
) -> Result<Vec<(PathBuf, LicenseId)>, Error> {
println!("g... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/collect-license-metadata/src/path_tree.rs | src/tools/collect-license-metadata/src/path_tree.rs | //! Tools like REUSE output per-file licensing information, but we need to condense it in the
//! minimum amount of data that still represents the same licensing metadata. This module is
//! responsible for that, by turning the list of paths into a tree and executing simplification
//! passes over the tree to remove re... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/jsondocck/src/config.rs | src/tools/jsondocck/src/config.rs | use getopts::Options;
#[derive(Debug)]
pub struct Config {
/// The directory documentation output was generated in
pub doc_dir: String,
/// The file documentation was generated for, with docck directives to check
pub template: String,
}
/// Create a Config from a vector of command-line arguments
pub f... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/jsondocck/src/directive.rs | src/tools/jsondocck/src/directive.rs | use std::borrow::Cow;
use serde_json::Value;
use crate::cache::Cache;
#[derive(Debug)]
pub struct Directive {
pub kind: DirectiveKind,
pub path: String,
pub lineno: usize,
}
#[derive(Debug)]
pub enum DirectiveKind {
/// `//@ has <path>`
///
/// Checks the path exists.
HasPath,
/// `... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/jsondocck/src/error.rs | src/tools/jsondocck/src/error.rs | use crate::Directive;
#[derive(Debug)]
pub struct CkError {
pub message: String,
pub directive: Directive,
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/jsondocck/src/main.rs | src/tools/jsondocck/src/main.rs | use std::process::ExitCode;
use std::sync::LazyLock;
use std::{env, fs};
use regex::{Regex, RegexBuilder};
mod cache;
mod config;
mod directive;
mod error;
use cache::Cache;
use config::parse_config;
use directive::{Directive, DirectiveKind};
use error::CkError;
fn main() -> ExitCode {
let config = parse_config... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/jsondocck/src/cache.rs | src/tools/jsondocck/src/cache.rs | use std::collections::HashMap;
use std::path::Path;
use fs_err as fs;
use serde_json::Value;
use crate::config::Config;
#[derive(Debug)]
pub struct Cache {
value: Value,
pub variables: HashMap<String, Value>,
}
impl Cache {
/// Create a new cache, used to read files only once and otherwise store their c... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/remote-test-server/src/main.rs | src/tools/remote-test-server/src/main.rs | //! This is a small server which is intended to run inside of an emulator or
//! on a remote test device. This server pairs with the `remote-test-client`
//! program in this repository. The `remote-test-client` connects to this
//! server over a TCP socket and performs work such as:
//!
//! 1. Pushing shared libraries ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/errors.rs | src/tools/compiletest/src/errors.rs | use std::fmt;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::sync::OnceLock;
use camino::Utf8Path;
use regex::Regex;
use tracing::*;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum ErrorKind {
Help,
Error,
Note,
Suggestion,
Warning,
Raw,
/// Used f... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/read2.rs | src/tools/compiletest/src/read2.rs | // FIXME: This is a complete copy of `cargo/src/cargo/util/read2.rs`
// Consider unify the read2() in libstd, cargo and this to prevent further code duplication.
#[cfg(test)]
mod tests;
use std::io::{self, Write};
use std::process::{Child, Output};
pub use self::imp::read2;
#[derive(Copy, Clone, Debug)]
pub enum Tr... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/rustdoc_gui_test.rs | src/tools/compiletest/src/rustdoc_gui_test.rs | //! This module isolates the compiletest APIs used by the rustdoc-gui-test tool.
//!
//! Thanks to this isolation layer, changes to compiletest directive parsing
//! might require changes to the items in this module, but shouldn't require
//! changes to rustdoc-gui-test itself.
//!
//! The current relationship between ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/diagnostics.rs | src/tools/compiletest/src/diagnostics.rs | //! Collection of diagnostics helpers for `compiletest` *itself*.
#[macro_export]
macro_rules! fatal {
($($arg:tt)*) => {
let status = ::colored::Colorize::bright_red("FATAL: ");
let status = ::colored::Colorize::bold(status);
eprint!("{status}");
eprintln!($($arg)*);
// Thi... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/panic_hook.rs | src/tools/compiletest/src/panic_hook.rs | use std::backtrace::{Backtrace, BacktraceStatus};
use std::cell::Cell;
use std::fmt::{Display, Write};
use std::panic::PanicHookInfo;
use std::sync::{Arc, LazyLock, Mutex};
use std::{env, mem, panic, thread};
type PanicHook = Box<dyn Fn(&PanicHookInfo<'_>) + Sync + Send + 'static>;
type CaptureBuf = Arc<Mutex<String>>... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/lib.rs | src/tools/compiletest/src/lib.rs | #![crate_name = "compiletest"]
#[cfg(test)]
mod tests;
pub mod cli;
mod common;
mod debuggers;
mod diagnostics;
mod directives;
mod edition;
mod errors;
mod executor;
mod json;
mod output_capture;
mod panic_hook;
mod raise_fd_limit;
mod read2;
mod runtest;
pub mod rustdoc_gui_test;
mod util;
use core::panic;
use std... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/tests.rs | src/tools/compiletest/src/tests.rs | use crate::debuggers::{extract_gdb_version, extract_lldb_version};
use crate::is_test;
#[test]
fn test_extract_gdb_version() {
macro_rules! test { ($($expectation:literal: $input:literal,)*) => {{$(
assert_eq!(extract_gdb_version($input), Some($expectation));
)*}}}
test! {
7000001: "GNU gd... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/output_capture.rs | src/tools/compiletest/src/output_capture.rs | use std::fmt;
use std::panic::RefUnwindSafe;
use std::sync::Mutex;
pub trait ConsoleOut: fmt::Debug + RefUnwindSafe {
fn write_fmt(&self, args: fmt::Arguments<'_>);
}
#[derive(Debug)]
pub(crate) struct Stdout;
impl ConsoleOut for Stdout {
fn write_fmt(&self, args: fmt::Arguments<'_>) {
print!("{args}... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/raise_fd_limit.rs | src/tools/compiletest/src/raise_fd_limit.rs | /// darwin_fd_limit exists to work around an issue where launchctl on macOS
/// defaults the rlimit maxfiles to 256/unlimited. The default soft limit of 256
/// ends up being far too low for our multithreaded scheduler testing, depending
/// on the number of cores available.
///
/// This fixes issue #7772.
#[cfg(target... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/cli.rs | src/tools/compiletest/src/cli.rs | //! Isolates the APIs used by `bin/main.rs`, to help minimize the surface area
//! of public exports from the compiletest library crate.
use std::env;
use std::io::IsTerminal;
use std::sync::Arc;
use crate::{early_config_check, parse_config, run_tests};
pub fn main() {
tracing_subscriber::fmt::init();
// co... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/json.rs | src/tools/compiletest/src/json.rs | //! These structs are a subset of the ones found in `rustc_errors::json`.
use std::path::{Path, PathBuf};
use std::sync::OnceLock;
use regex::Regex;
use serde::Deserialize;
use crate::errors::{Error, ErrorKind};
#[derive(Deserialize)]
struct Diagnostic {
message: String,
code: Option<DiagnosticCode>,
le... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/edition.rs | src/tools/compiletest/src/edition.rs | use crate::fatal;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Edition {
// Note that the ordering here is load-bearing, as we want the future edition to be greater than
// any year-based edition.
Year(u32),
Future,
}
impl std::fmt::Display for Edition {
fn fmt(&sel... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/runtest.rs | src/tools/compiletest/src/runtest.rs | use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
use std::fs::{self, create_dir_all};
use std::hash::{DefaultHasher, Hash, Hasher};
use std::io::prelude::*;
use std::process::{Child, Command, ExitStatus, Output, Stdio};
use std::{env, fmt, io, iter, str};
use build_helper::fs::re... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/util.rs | src/tools/compiletest/src/util.rs | use std::env;
use std::process::Command;
use camino::{Utf8Path, Utf8PathBuf};
#[cfg(test)]
mod tests;
pub fn make_new_path(path: &str) -> String {
assert!(cfg!(windows));
// Windows just uses PATH as the library search path, so we have to
// maintain the current value while adding our own
match env::... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/executor.rs | src/tools/compiletest/src/executor.rs | //! This module contains a reimplementation of the subset of libtest
//! functionality needed by compiletest.
//!
//! FIXME(Zalathar): Much of this code was originally designed to mimic libtest
//! as closely as possible, for ease of migration. Now that libtest is no longer
//! used, we can potentially redesign things ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/directives.rs | src/tools/compiletest/src/directives.rs | use std::collections::HashSet;
use std::process::Command;
use std::{env, fs};
use camino::{Utf8Path, Utf8PathBuf};
use semver::Version;
use tracing::*;
use crate::common::{CodegenBackend, Config, Debugger, FailMode, PassMode, RunFailMode, TestMode};
use crate::debuggers::{extract_cdb_version, extract_gdb_version};
pu... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/debuggers.rs | src/tools/compiletest/src/debuggers.rs | use std::env;
use std::process::Command;
use std::sync::Arc;
use camino::Utf8Path;
use crate::common::{Config, Debugger};
pub(crate) fn configure_cdb(config: &Config) -> Option<Arc<Config>> {
config.cdb.as_ref()?;
Some(Arc::new(Config { debugger: Some(Debugger::Cdb), ..config.clone() }))
}
pub(crate) fn co... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/common.rs | src/tools/compiletest/src/common.rs | use std::borrow::Cow;
use std::collections::{BTreeSet, HashMap, HashSet};
use std::iter;
use std::process::Command;
use std::sync::OnceLock;
use build_helper::git::GitConfig;
use camino::{Utf8Path, Utf8PathBuf};
use semver::Version;
use crate::edition::Edition;
use crate::fatal;
use crate::util::{Utf8PathBufExt, add_... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | true |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/util/tests.rs | src/tools/compiletest/src/util/tests.rs | use super::*;
#[test]
fn path_buf_with_extra_extension_test() {
assert_eq!(
Utf8PathBuf::from("foo.rs.stderr"),
Utf8PathBuf::from("foo.rs").with_extra_extension("stderr")
);
assert_eq!(
Utf8PathBuf::from("foo.rs.stderr"),
Utf8PathBuf::from("foo.rs").with_extra_extension(".st... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/errors/tests.rs | src/tools/compiletest/src/errors/tests.rs | use super::*;
#[test]
fn test_parse_expected_matching() {
// Ensure that we correctly extract expected revisions
let d1 = "//[rev1,rev2]~^ ERROR foo";
let d2 = "//[rev1,rev2-foo]~^ ERROR foo";
assert!(parse_expected(None, 1, d1, Some("rev1")).is_some());
assert!(parse_expected(None, 1, d1, Some("re... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/bin/main.rs | src/tools/compiletest/src/bin/main.rs | fn main() {
compiletest::cli::main();
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/executor/deadline.rs | src/tools/compiletest/src/executor/deadline.rs | use std::collections::VecDeque;
use std::sync::mpsc::{self, RecvError, RecvTimeoutError};
use std::time::{Duration, Instant};
use crate::executor::{CollectedTest, TestId};
const TEST_WARN_TIMEOUT_S: u64 = 60;
struct DeadlineEntry<'a> {
id: TestId,
test: &'a CollectedTest,
deadline: Instant,
}
pub(crate)... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/compiletest/src/executor/json.rs | src/tools/compiletest/src/executor/json.rs | //! Collects statistics and emits suite/test events as JSON messages, using
//! the same JSON format as libtest's JSON formatter.
//!
//! These messages are then parsed by bootstrap, which replaces them with
//! user-friendly terminal output.
use std::time::Instant;
use serde_json::json;
use crate::executor::{Collec... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.