Skip to content

Commit f9077b8

Browse files
committed
Auto merge of #720 - Susurrus:fcntl, r=alexcrichton
Add more fcntl and seal constants for Android/Linux
2 parents 13478d0 + b7902df commit f9077b8

File tree

27 files changed

+237
-166
lines changed

27 files changed

+237
-166
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,17 @@ matrix:
5151
- os: osx
5252
osx_image: xcode8.2
5353
env: TARGET=i386-apple-ios
54+
CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
55+
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
56+
before_install:
57+
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
5458
- os: osx
5559
osx_image: xcode8.2
5660
env: TARGET=x86_64-apple-ios
61+
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
62+
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
63+
before_install:
64+
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
5765
- env: TARGET=x86_64-rumprun-netbsd
5866
- env: TARGET=powerpc-unknown-linux-gnu
5967
- env: TARGET=powerpc64-unknown-linux-gnu

Cargo.lock

+7-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ With that in mind, the steps for adding a new API are:
9393
We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc):
9494

9595
1. [`libc-test`](https://github.com/alexcrichton/ctest)
96-
- `cd libc-test && cargo run`
96+
- `cd libc-test && cargo test`
9797
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
9898
2. Style checker
9999
- `rustc ci/style.rs && ./style src`

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ build: false
2424

2525
test_script:
2626
- cargo test --target %TARGET%
27-
- cargo run --manifest-path libc-test/Cargo.toml --target %TARGET%
27+
- cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%
2828

2929
cache:
3030
- target

ci/docker/aarch64-linux-android/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2929

3030
ENV PATH=$PATH:/rust/bin \
3131
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
32+
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
3233
HOME=/tmp
34+
35+
ADD runtest-android.rs /tmp/runtest.rs
36+
ENTRYPOINT [ \
37+
"bash", \
38+
"-c", \
39+
# set SHELL so android can detect a 64bits system, see
40+
# http://stackoverflow.com/a/41789144
41+
"SHELL=/bin/dash emulator @aarch64 -no-window & \
42+
rustc /tmp/runtest.rs -o /tmp/runtest && \
43+
exec \"$@\"", \
44+
"--" \
45+
]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ubuntu:17.10
2-
RUN apt-get update
3-
RUN apt-get install -y --no-install-recommends \
2+
RUN apt-get update && apt-get install -y --no-install-recommends \
43
gcc libc6-dev ca-certificates \
54
gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
65
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
6+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
77
PATH=$PATH:/rust/bin

ci/docker/arm-linux-androideabi/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2929

3030
ENV PATH=$PATH:/rust/bin \
3131
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
32+
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
3233
HOME=/tmp
34+
35+
ADD runtest-android.rs /tmp/runtest.rs
36+
ENTRYPOINT [ \
37+
"bash", \
38+
"-c", \
39+
# set SHELL so android can detect a 64bits system, see
40+
# http://stackoverflow.com/a/41789144
41+
"SHELL=/bin/dash emulator @arm -no-window & \
42+
rustc /tmp/runtest.rs -o /tmp/runtest && \
43+
exec \"$@\"", \
44+
"--" \
45+
]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ubuntu:17.10
2-
RUN apt-get update
3-
RUN apt-get install -y --no-install-recommends \
2+
RUN apt-get update && apt-get install -y --no-install-recommends \
43
gcc libc6-dev ca-certificates \
54
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
65
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
6+
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
77
PATH=$PATH:/rust/bin

ci/docker/i686-linux-android/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2929

3030
ENV PATH=$PATH:/rust/bin \
3131
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
32+
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
3233
HOME=/tmp
34+
35+
ADD runtest-android.rs /tmp/runtest.rs
36+
ENTRYPOINT [ \
37+
"bash", \
38+
"-c", \
39+
# set SHELL so android can detect a 64bits system, see
40+
# http://stackoverflow.com/a/41789144
41+
"SHELL=/bin/dash emulator @i686 -no-window -no-accel & \
42+
rustc /tmp/runtest.rs -o /tmp/runtest && \
43+
exec \"$@\"", \
44+
"--" \
45+
]
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FROM ubuntu:17.10
22

3-
RUN apt-get update
4-
RUN apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
54
gcc libc6-dev qemu-user ca-certificates \
65
gcc-mips-linux-gnu libc6-dev-mips-cross \
76
qemu-system-mips
87

98
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
9+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \
1010
PATH=$PATH:/rust/bin

ci/docker/mips-unknown-linux-musl/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM ubuntu:17.10
22

3-
RUN apt-get update
4-
RUN apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
54
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
65
bzip2
76

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

1514
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
1615
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
17-
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc
16+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
17+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM ubuntu:17.10
22

3-
RUN apt-get update
4-
RUN apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
54
gcc libc6-dev qemu-user ca-certificates \
65
gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
76
qemu-system-mips64
87

98
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
9+
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \
1010
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
1111
PATH=$PATH:/rust/bin

ci/docker/mipsel-unknown-linux-musl/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM ubuntu:17.10
22

3-
RUN apt-get update
4-
RUN apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
54
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
65
bzip2
76

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

1514
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
1615
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
17-
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc
16+
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
17+
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FROM ubuntu:17.10
22

3-
RUN apt-get update
4-
RUN apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
54
gcc libc6-dev qemu-user ca-certificates \
65
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
76
qemu-system-ppc
87

98
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
9+
CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \
1010
PATH=$PATH:/rust/bin
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM ubuntu:17.10
22

3-
RUN apt-get update
4-
RUN apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
54
gcc libc6-dev qemu-user ca-certificates \
65
gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
76
qemu-system-ppc
87

98
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
9+
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
1010
CC=powerpc64-linux-gnu-gcc \
1111
PATH=$PATH:/rust/bin

ci/docker/s390x-unknown-linux-gnu/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55
gcc-s390x-linux-gnu libc6-dev-s390x-cross
66

77
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
8+
# TODO: in theory we should execute this, but qemu segfaults immediately :(
9+
# CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \
10+
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \
811
CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \
912
PATH=$PATH:/rust/bin

ci/docker/x86_64-rumprun-netbsd/Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ USER root
33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
55
qemu
6-
ENV PATH=$PATH:/rust/bin
6+
ENV PATH=$PATH:/rust/bin \
7+
CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest
8+
9+
ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/
10+
ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"]
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
use std::env;
2+
use std::process::{Command, Stdio};
3+
use std::sync::mpsc;
4+
use std::thread;
5+
use std::time::Duration;
6+
use std::io::{BufRead, BufReader, Read};
7+
8+
fn main() {
9+
assert_eq!(env::args().len(), 2);
10+
11+
let status = Command::new("rumprun-bake")
12+
.arg("hw_virtio")
13+
.arg("/tmp/libc-test.img")
14+
.arg(env::args().nth(1).unwrap())
15+
.status()
16+
.expect("failed to run rumprun-bake");
17+
assert!(status.success());
18+
19+
let mut child = Command::new("qemu-system-x86_64")
20+
.arg("-nographic")
21+
.arg("-vga").arg("none")
22+
.arg("-m").arg("64")
23+
.arg("-kernel").arg("/tmp/libc-test.img")
24+
.stdout(Stdio::piped())
25+
.stderr(Stdio::piped())
26+
.spawn()
27+
.expect("failed to spawn qemu");
28+
29+
let mut stdout = child.stdout.take().unwrap();
30+
let mut stderr = child.stderr.take().unwrap();
31+
let (tx, rx) = mpsc::channel();
32+
let tx2 = tx.clone();
33+
let t1 = thread::spawn(move || find_ok(&mut stdout, tx));
34+
let t2 = thread::spawn(move || find_ok(&mut stderr, tx2));
35+
36+
let res = rx.recv_timeout(Duration::new(5, 0));
37+
child.kill().unwrap();
38+
t1.join().unwrap();
39+
t2.join().unwrap();
40+
41+
if res.is_err() {
42+
panic!("didn't find success");
43+
}
44+
}
45+
46+
fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) {
47+
for line in BufReader::new(input).lines() {
48+
let line = line.unwrap();
49+
println!("{}", line);
50+
if line.starts_with("PASSED ") && line.contains(" tests") {
51+
tx.send(()).unwrap();
52+
}
53+
}
54+
}

ci/run-docker.sh

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ run() {
1414
docker run \
1515
--user `id -u`:`id -g` \
1616
--rm \
17+
--init \
1718
--volume $HOME/.cargo:/cargo \
1819
$kvm \
1920
--env CARGO_HOME=/cargo \

0 commit comments

Comments
 (0)