This script automates the process of running compilation tests of KCBench on various architectures, including X86-64, arm64, riscv, and powerpc. It also provides instruction on how to setup containerized and virtualized envieronments. The script generates detailed compilation results and stores them in log files with timestamps for reference.
Before running the KCBench compilation tests, ensure that you have the following dependencies installed on your system:
bc
bison
curl
flex
make
time
perl
gcc
pkg-config
git
tar
elfutils-libelf-devel
openssl-devel
gcc-powerpc64-linux-gnu
gcc-arm-linux-gnu
gcc-aarch64-linux-gnu
gcc-riscv64-linux-gnu
qemu
lxc
lxc-templates
lxc-extra
debootstrap
libvirt
perl
gpg
wget
gcc-x86_64-linux-gnu
gcc-c++-powerpc64-linux-gnu
gcc-c++-powerpc64le-linux-gnu
gcc-powerpc64le-linux-gnu
openssl
virt-install
Command:
dnf update
dnf install bc bison curl flex make time perl gcc pkg-config git tar elfutils-libelf-devel openssl-devel gcc-powerpc64-linux-gnu gcc-arm-linux-gnu gcc-aarch64-linux-gnu gcc-riscv64-linux-gnu qemu lxc lxc-templates lxc-extra debootstrap libvirt perl gpg wget gcc-c++-powerpc64-linux-gnu gcc-c++-powerpc64le-linux-gnu gcc-powerpc64le-linux-gnu openssl virt-install gcc-x86_64-linux-gnu
For this we expect you to be running the same dist/os/version as in the container and virtual-machine, in our case Fedora 38.
- For the host the only step is to install its dependencies, here.
To run the KCBench compilation tests in an LXC container with Fedora 40, follow these steps:
-
Install LXC on your system.
sudo dnf install lxc lxc-templates
-
Start lxc, make sure lxc is enabled and running
systemctl enable --now lxc
-
Create an LXC container using a Fedora 40 image:
lxc-create -n fedora-container -t download -- -d fedora -r 40 -a amd64
-
Mount the host /root directory to the container's home directory. This can be done by editing the container's configuration file, typically located at /var/lib/lxc/fedora-container/config. Add the following line to the configuration file:
lxc.mount.entry = /root mnt/host-root none bind,create=dir 0 0
-
Start the LXC container:
lxc-start fedora-container
-
Enter the container's shell:
lxc-attach fedora-container
-
inside the container install this project dependencies as shown here.
To run the KCBench compilation tests in a Docker container with Fedora 40, follow these steps:
-
Install Docker on your system.
sudo dnf -y install dnf-plugins-core sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io
-
Start the Docker service:
sudo systemctl start docker
-
Pull the Fedora 40 Docker image:
sudo docker pull fedora:40
-
Create a Docker container using the Fedora 40 image:
sudo docker run -it -v /root:/mnt/host-root --name fedora-container fedora:40
-
Install the project dependencies inside the container as shown here.
-
You can now proceed with cloning the KCBench repository and running the compilation tests.
To run the KCBench compilation tests in a Podman container with Fedora 40, follow these steps:
-
Install Podman on your system (if not already installed):
sudo dnf install podman
-
Pull the Fedora 40 Podman image:
podman pull fedora:40
-
Create a Podman container using the Fedora 40 image:
podman run -it -v /root:/mnt/host-root --security-opt label=disable --name fedora-container fedora:40
-
Install the project dependencies inside the container as shown here.
-
You can now proceed with cloning the KCBench repository and running the compilation tests.
Note: Podman is designed to be a drop-in replacement for Docker, so most Docker commands can be used with Podman by simply replacing docker
with podman
in the command.
To reprodute this repository tests you will need to:
-
Clone the KCBench repository and its sub-repositories:
git clone git@github.com:zampierilucas/tcc-tests.git --recurse-submodules
-
Enter its directory to the KCBench directory:
cd tcc-tests
-
Run the KCBench compilation tests using the script provided with this repo
test-scripts
folder.