From 89b77fc9b60cb04425929155a5582f11af4abba7 Mon Sep 17 00:00:00 2001
From: Yuki Okushi <huyuumi.dev@gmail.com>
Date: Sat, 17 Oct 2020 22:21:24 +0900
Subject: [PATCH 1/3] Drop FreeBSD 10 and add FreeBSD 13 image on Cirrus CI

---
 .cirrus.yml | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 4487219628556..faef69c2ab1c8 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,40 +1,41 @@
 task:
-  name: nightly x86_64-unknown-freebsd-10
+  name: stable x86_64-unknown-freebsd-11
   freebsd_instance:
-    image: freebsd-10-4-release-amd64
+    image: freebsd-11-4-release-amd64
   setup_script:
     - pkg install -y curl
     - curl https://sh.rustup.rs -sSf --output rustup.sh
-    - sh rustup.sh --default-toolchain nightly -y --profile=minimal
+    - sh rustup.sh -y --profile=minimal
     - . $HOME/.cargo/env
-    - rustup default nightly
+    - rustup default stable
   test_script:
     - . $HOME/.cargo/env
     - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
+    - sh ci/run.sh x86_64-unknown-freebsd
 
 task:
-  name: stable x86_64-unknown-freebsd-11
+  name: nightly x86_64-unknown-freebsd-12
   freebsd_instance:
-    image: freebsd-11-4-release-amd64
+    image: freebsd-12-1-release-amd64
   setup_script:
     - pkg install -y curl
     - curl https://sh.rustup.rs -sSf --output rustup.sh
-    - sh rustup.sh -y --profile=minimal
+    - sh rustup.sh --default-toolchain nightly -y --profile=minimal
     - . $HOME/.cargo/env
-    - rustup default stable
+    - rustup default nightly
   test_script:
     - . $HOME/.cargo/env
     - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
     - sh ci/run.sh x86_64-unknown-freebsd
 
 task:
-  name: nightly x86_64-unknown-freebsd-12
+  name: nightly x86_64-unknown-freebsd-13
   freebsd_instance:
-    image: freebsd-12-1-release-amd64
+    image: freebsd-13-0-current-amd64-v20201001
   setup_script:
     - pkg install -y curl
     - curl https://sh.rustup.rs -sSf --output rustup.sh
-    - sh rustup.sh --default-toolchain nightly -y --profile=minimal
+    - sh rustup.sh -y --profile=minimal
     - . $HOME/.cargo/env
     - rustup default nightly
   test_script:

From f57b285c5e47c58f5a74e27f17ed110666ab7cd5 Mon Sep 17 00:00:00 2001
From: Yuki Okushi <huyuumi.dev@gmail.com>
Date: Sat, 17 Oct 2020 23:42:25 +0900
Subject: [PATCH 2/3] Skip `MINCORE_SUPER` on FreeBSD 13

---
 libc-test/build.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libc-test/build.rs b/libc-test/build.rs
index b9120809b8ae3..65b049a9cce75 100755
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1843,6 +1843,11 @@ fn test_freebsd(target: &str) {
             // This was renamed in FreeBSD 12.2 and 13 (r350749).
             "IPPROTO_SEP" | "IPPROTO_DCCP" => true,
 
+            // This was changed to 96(0x60) in FreeBSD 13:
+            // https://github.com/freebsd/freebsd/
+            // commit/06b00ceaa914a3907e4e27bad924f44612bae1d7
+            "MINCORE_SUPER" if Some(13) == freebsd_ver => true,
+
             _ => false,
         }
     });

From 7aa60269ae6cecd01831f5ec62d8c582e24de4fd Mon Sep 17 00:00:00 2001
From: Yuki Okushi <huyuumi.dev@gmail.com>
Date: Mon, 19 Oct 2020 21:36:58 +0900
Subject: [PATCH 3/3] Skip some tests for `mips64(el)-unknown-linux-gnuabi64`

---
 ci/run.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ci/run.sh b/ci/run.sh
index 6fb059d2eae58..cbf644e4481a1 100755
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -121,6 +121,10 @@ else
 
   cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}"
 
+  # FIXME: Somehow it now emits errors like:
+  # `relocation truncated to fit: R_MIPS_GOT_DISP against `fchmod@@GLIBC_2.0'`
+  if [ "$TARGET" != "mips64el-unknown-linux-gnuabi64" ] && [ "$TARGET" != "mips64-unknown-linux-gnuabi64" ]; then
   cargo test $opt --features extra_traits --manifest-path libc-test/Cargo.toml \
     --target "${TARGET}"
+  fi
 fi