Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion scripts/contest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ fi

LOGFILE="${ROOT}/test.log"

# Pick arch-specific bundle when available.
# Fall back to bundle.tar.gz (x86_64) if there is no
# arch-specific tarball.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a warning log for the fallback case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added.

if [ ! -f ${ROOT}/bundle.tar.gz ]; then
cp ${ROOT}/tests/contest/contest/bundle.tar.gz ${ROOT}/bundle.tar.gz
ARCH=$(uname -m)
ARCH_BUNDLE="${ROOT}/tests/contest/contest/bundle-${ARCH}.tar.gz"
DEFAULT_BUNDLE="${ROOT}/tests/contest/contest/bundle.tar.gz"
if [ -f "${ARCH_BUNDLE}" ]; then
cp "${ARCH_BUNDLE}" "${ROOT}/bundle.tar.gz"
else
echo "WARN: no bundle for ${ARCH}, falling back to default"
cp "${DEFAULT_BUNDLE}" "${ROOT}/bundle.tar.gz"
fi
fi
touch ${LOGFILE}

Expand Down
Binary file added tests/contest/contest/bundle-aarch64.tar.gz
Binary file not shown.
25 changes: 20 additions & 5 deletions tests/contest/contest/src/tests/personality/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use oci_spec::runtime::{
LinuxBuilder, LinuxPersonalityBuilder, LinuxPersonalityDomain, ProcessBuilder, Spec,
SpecBuilder,
};
use test_framework::{Test, TestGroup, TestResult, test_result};
use test_framework::{ConditionalTest, TestGroup, TestResult, test_result};

use crate::utils::test_utils::{
check_container_created, exec_container, start_container, test_outside_container,
Expand Down Expand Up @@ -70,14 +70,29 @@ fn personality_for_linux64() -> TestResult {
personality_for_linux(LinuxPersonalityDomain::PerLinux, "x86_64")
}

/// The expected `uname -m` output (i686 / x86_64) is x86 specific, so skip
/// these tests on non-x86_64 hosts.
///
/// TODO: Add architecture-specific expectations for non-x86_64 hosts if possible.
fn is_x86_64() -> bool {
cfg!(target_arch = "x86_64")
}

pub fn get_personality_test() -> TestGroup {
let mut test_group = TestGroup::new("personality");
let personality_for_linux32 =
Test::new("personality_for_linux32", Box::new(personality_for_linux32));

let personality_for_linux32 = ConditionalTest::new(
"personality_for_linux32",
Box::new(is_x86_64),
Box::new(personality_for_linux32),
);
test_group.add(vec![Box::new(personality_for_linux32)]);

let personality_for_linux64 =
Test::new("personality_for_linux64", Box::new(personality_for_linux64));
let personality_for_linux64 = ConditionalTest::new(
"personality_for_linux64",
Box::new(is_x86_64),
Box::new(personality_for_linux64),
);
test_group.add(vec![Box::new(personality_for_linux64)]);

test_group
Expand Down
Loading