|
| 1 | +# Test following features in the test framework. |
| 2 | +# - Create a virtual machine with hotpluggable CXL memories (none attached at boot time). |
| 3 | +# - Building and installing a custom kernel with custom configuration. |
| 4 | +# - Using udev-monitor for detecting hardware configuration changes. |
| 5 | +# - Hotplugging, onlining, offlining and hotremoving CXL memories. |
| 6 | + |
| 7 | +if [[ "$distro" != *"fedora"* ]]; then |
| 8 | + echo "SKIP: this test runs only on fedora" |
| 9 | + exit 0 |
| 10 | +fi |
| 11 | + |
| 12 | +vm-kernel-pkgs-install |
| 13 | + |
| 14 | +vm-command "command -v cxl || dnf install -y /usr/bin/cxl numactl golang" |
| 15 | + |
| 16 | +vm-command "mkdir udev-monitor 2>/dev/null" && { |
| 17 | + udev_monitor_tool="${TEST_DIR%%/test/e2e/*}/scripts/udev-monitor/udev-monitor.go" |
| 18 | + vm-put-file "$udev_monitor_tool" "./udev-monitor/udev-monitor.go" |
| 19 | + vm-command "cd udev-monitor && go mod init udev-monitor && go mod tidy && go build . && cp -v udev-monitor /usr/local/bin" |
| 20 | +} |
| 21 | + |
| 22 | +echo "launching udev-monitor in the background" |
| 23 | +vm-command-q "udev-monitor 2>&1 | tee udev-monitor.output" & |
| 24 | + |
| 25 | +sleep 2 |
| 26 | +echo "next: hotplug CXL" |
| 27 | +vm-cxl-hotplug cxl_memdev0 |
| 28 | + |
| 29 | +sleep 2 |
| 30 | +vm-command "set -x |
| 31 | + sh -c 'grep . /sys/devices/system/node/{online,possible} /sys/devices/system/memory/auto_online_blocks' |
| 32 | + echo online_movable > /sys/devices/system/memory/auto_online_blocks |
| 33 | + sh -c 'grep 0 /sys/devices/system/memory/memory*/online' |
| 34 | + sleep 1 |
| 35 | + cxl enable-memdev mem0 |
| 36 | + sleep 1 |
| 37 | + cxl create-region -t ram -d decoder0.0 -m mem0 |
| 38 | + sleep 1 |
| 39 | + cxl enable-region region0 |
| 40 | + sleep 1 |
| 41 | + sh -c 'grep . /sys/devices/system/node/{online,possible}' |
| 42 | + sh -c 'grep 0 /sys/devices/system/memory/memory*/online' |
| 43 | + sh -c 'for f in /sys/devices/system/memory/memory*/online; do echo 1 > \$f; done' |
| 44 | + sleep 1 |
| 45 | + sh -c 'grep 0 /sys/devices/system/memory/memory*/online' |
| 46 | + " |
| 47 | +sleep 2 |
| 48 | +echo "hotplugging more memories" |
| 49 | +sleep 2 |
| 50 | +vm-cxl-hotplug cxl_memdev3 |
| 51 | +vm-cxl-hotplug cxl_memdev1 |
| 52 | +vm-cxl-hotplug cxl_memdev2 |
| 53 | +sleep 5 |
| 54 | +vm-command "cxl list" |
| 55 | + |
| 56 | +echo "hotremoving single memory" |
| 57 | +vm-cxl-hotremove cxl_memdev2 |
| 58 | +sleep 5 |
| 59 | +vm-command "cxl list" |
0 commit comments