Skip to contentSkip to conversation

um: Run kselftests under UML

uml-devel Thomas Meyer 1 participant 1 message Jul 29, 2017 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

Hi,

I did write a small script that compiles a user mode linux kernel and then run all kselftests under this kernel.

What do you think about this idea?

script is:

#!/bin/sh

# x86_64 or i386
SUBARCH=x86_64

LINUX_DIR=/home/thomas/git/linux

RAW_FILE=Fedora-Cloud-Base-26-1.5.x86_64.raw
CLOUD_INIT_FILE=Fedora-Cloud-Base-Init.iso
KSELFTEST_FILE=Fedora-Cloud-Base-kselftests.img

if [ ! -f "$RAW_FILE" ]; then
curl -OL "https://download.fedoraproject.org/pub/fedora/linux/releases/26/CloudImages/x86_64/images/$RAW_FILE.xz" unxz $RAW_FILE.xz
fi

if [ ! -f "$CLOUD_INIT_FILE" ]; then
{ echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data cat > user-data << EOF
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True

mounts:
- [ /dev/ubdc, /opt ]

write_files:
- content: |

     [Unit]
     Description=/etc/rc.d/rc.local Compatibility
     [Install]
     WantedBy=multi-user.target
     [Service]
     Type=simple
     ExecStart=/bin/sh /opt/run_kselftest.sh
     TimeoutSec=0
     RemainAfterExit=yes
     GuessMainPID=no
     WorkingDirectory=/opt/
     StandardOutput=journal+console

path: /etc/systemd/system/kselftest.service
permissions: '0755'

runcmd:
- [ systemctl, daemon-reload ]
- [ systemctl, enable, kselftest.service ]
- [ systemctl, start, --no-block, kselftest.service ]

EOF

## create a disk to attach with some user-data and meta-data genisoimage -output $CLOUD_INIT_FILE -volid cidata -joliet -rock user-data meta-data
fi

# build kernel
# neither allyesconfig nor defconfig work correctly, because of failing build, missing config options
# so use a custom config for now. FIXME: goal should be to use allyesconfig?
cp config-$SUBARCH $LINUX_DIR/.config
make ARCH=um -C $LINUX_DIR/ -j$(nproc) all
# build and install kselftests
# used by kselftest install
export INSTALL_PATH=`mktemp -d`
make -C $LINUX_DIR/tools/testing/selftests all install
mke2fs -F -d $INSTALL_PATH $KSELFTEST_FILE 256m
rm -R $INSTALL_PATH

$LINUX_DIR/linux mem=1280m umid=kselftests ubd0=$RAW_FILE.cow,$RAW_FILE ubd1=$CLOUD_INIT_FILE ubd2=$KSELFTEST_FILE root=/dev/ubda1 ro rhgb quiet LANG=de_DE.UTF-8 plymouth.enable=0 con=pts con0=fd:0,fd:1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel