Skip to content

Commit

Permalink
Auto merge of #720 - Susurrus:fcntl, r=alexcrichton
Browse files Browse the repository at this point in the history
Add more fcntl and seal constants for Android/Linux
  • Loading branch information
bors committed Aug 24, 2017
2 parents f4bbd7f + b7902df commit e717ea6
Show file tree
Hide file tree
Showing 27 changed files with 237 additions and 166 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ matrix:
- os: osx
osx_image: xcode8.2
env: TARGET=i386-apple-ios
CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
before_install:
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
- os: osx
osx_image: xcode8.2
env: TARGET=x86_64-apple-ios
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
before_install:
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
- env: TARGET=x86_64-rumprun-netbsd
- env: TARGET=powerpc-unknown-linux-gnu
- env: TARGET=powerpc64-unknown-linux-gnu
Expand Down
21 changes: 7 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ With that in mind, the steps for adding a new API are:
We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc):

1. [`libc-test`](https://github.com/alexcrichton/ctest)
- `cd libc-test && cargo run`
- `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
- `rustc ci/style.rs && ./style src`
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ build: false

test_script:
- cargo test --target %TARGET%
- cargo run --manifest-path libc-test/Cargo.toml --target %TARGET%
- cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%

cache:
- target
Expand Down
13 changes: 13 additions & 0 deletions ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash emulator @aarch64 -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
4 changes: 2 additions & 2 deletions ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:17.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
PATH=$PATH:/rust/bin
13 changes: 13 additions & 0 deletions ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash emulator @arm -no-window & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
4 changes: 2 additions & 2 deletions ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:17.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
PATH=$PATH:/rust/bin
13 changes: 13 additions & 0 deletions ci/docker/i686-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash emulator @i686 -no-window -no-accel & \
rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
4 changes: 2 additions & 2 deletions ci/docker/mips-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM ubuntu:17.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-mips-linux-gnu libc6-dev-mips-cross \
qemu-system-mips

ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \
PATH=$PATH:/rust/bin
6 changes: 3 additions & 3 deletions ci/docker/mips-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:17.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
bzip2

Expand All @@ -14,4 +13,5 @@ RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-SDK-ar71xx-generi

ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
4 changes: 2 additions & 2 deletions ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM ubuntu:17.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
qemu-system-mips64

ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
PATH=$PATH:/rust/bin
6 changes: 3 additions & 3 deletions ci/docker/mipsel-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:17.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
bzip2

Expand All @@ -14,4 +13,5 @@ RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-l

ENV PATH=$PATH:/rust/bin:/toolchain/bin \
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
4 changes: 2 additions & 2 deletions ci/docker/powerpc-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM ubuntu:17.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
qemu-system-ppc

ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \
PATH=$PATH:/rust/bin
4 changes: 2 additions & 2 deletions ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM ubuntu:17.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
qemu-system-ppc

ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
CC=powerpc64-linux-gnu-gcc \
PATH=$PATH:/rust/bin
3 changes: 3 additions & 0 deletions ci/docker/s390x-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-s390x-linux-gnu libc6-dev-s390x-cross

ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
# TODO: in theory we should execute this, but qemu segfaults immediately :(
# CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \
CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \
PATH=$PATH:/rust/bin
6 changes: 5 additions & 1 deletion ci/docker/x86_64-rumprun-netbsd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ USER root
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
qemu
ENV PATH=$PATH:/rust/bin
ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest

ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/
ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"]
54 changes: 54 additions & 0 deletions ci/docker/x86_64-rumprun-netbsd/runtest.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
use std::env;
use std::process::{Command, Stdio};
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
use std::io::{BufRead, BufReader, Read};

fn main() {
assert_eq!(env::args().len(), 2);

let status = Command::new("rumprun-bake")
.arg("hw_virtio")
.arg("/tmp/libc-test.img")
.arg(env::args().nth(1).unwrap())
.status()
.expect("failed to run rumprun-bake");
assert!(status.success());

let mut child = Command::new("qemu-system-x86_64")
.arg("-nographic")
.arg("-vga").arg("none")
.arg("-m").arg("64")
.arg("-kernel").arg("/tmp/libc-test.img")
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
.expect("failed to spawn qemu");

let mut stdout = child.stdout.take().unwrap();
let mut stderr = child.stderr.take().unwrap();
let (tx, rx) = mpsc::channel();
let tx2 = tx.clone();
let t1 = thread::spawn(move || find_ok(&mut stdout, tx));
let t2 = thread::spawn(move || find_ok(&mut stderr, tx2));

let res = rx.recv_timeout(Duration::new(5, 0));
child.kill().unwrap();
t1.join().unwrap();
t2.join().unwrap();

if res.is_err() {
panic!("didn't find success");
}
}

fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) {
for line in BufReader::new(input).lines() {
let line = line.unwrap();
println!("{}", line);
if line.starts_with("PASSED ") && line.contains(" tests") {
tx.send(()).unwrap();
}
}
}
1 change: 1 addition & 0 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ run() {
docker run \
--user `id -u`:`id -g` \
--rm \
--init \
--volume $HOME/.cargo:/cargo \
$kvm \
--env CARGO_HOME=/cargo \
Expand Down
Loading

0 comments on commit e717ea6

Please sign in to comment.