Skip to content

Commit

Permalink
2.Pre-compiled end-to-end gpu driver validation
Browse files Browse the repository at this point in the history
Signed-off-by: shiva kumar <[email protected]>
  • Loading branch information
shivakunv committed Aug 25, 2024
1 parent 31893c3 commit 7b746ba
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
types:
- completed
branches:
- e2etestdriver
- e2etestdriver_no

pull_request:
types:
Expand All @@ -29,12 +29,12 @@ on:
branches:
# - main
# - release-*
- e2etestdriver
- e2etestdriver_no
push:
branches:
# - main
# - release-*
- e2etestdriver
- e2etestdriver_no

jobs:
e2e-tests-nvidiadriver:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_precompiled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ jobs:
- name: Precompiled e2e test- upgrade kernel and Validate gpu driver
env:
TEST_CASE_KERNEL_UPGRADE: "./tests/cases/nvidia-kernel-upgrade.sh"
KERNEL_UPGRADE: "./tests/scripts/upgrade-kernel.sh"
TEST_CASE: "./tests/cases/nvidia-driver.sh"
OPERATOR_OPTIONS: "--set driver.repository=${{ env.PRIVATE_REGISTRY }}/nvidia --set driver.usePrecompiled=true"
run: |
rc=0
for driver_version in ${DRIVER_VERSIONS}; do
echo "Running e2e for DRIVER_VERSION=$driver_version"
status=0
./tests/ci-run-e2e.sh "${TEST_CASE_KERNEL_UPGRADE}" "${driver_version}" "${OPERATOR_OPTIONS}" || status=$?
./tests/ci-run-e2e.sh "${KERNEL_UPGRADE}" "${driver_version}" "${OPERATOR_OPTIONS}" || status=$?
if [ $status -ne 0 ]; then
echo "Kernel upgrade failed"
rc=$status
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/.definitions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ CASES_DIR="$( cd "${TEST_DIR}/cases" && pwd )"
: ${SYSTEM_ONLINE_CHECK_TIMEOUT:="900"}

: ${BASE_TARGET:="jammy"}
: ${GRUB_FILE:="/boot/grub/grub.cfg"}
43 changes: 36 additions & 7 deletions tests/scripts/nvidia-kernel-upgrade-aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ echo "Current kernel version: $CURRENT_KERNEL"
if [ "${CURRENT_KERNEL}" != ${KERNEL_VERSION} ]; then
echo ""
echo ""
echo "--------------Starting the Precompiled kernel version ${KERNEL_VERSION} upgrade--------------"
echo "--------------Upgrading kernel to ${KERNEL_VERSION}--------------"

sudo apt-get update -y
sudo apt-get install --allow-downgrades linux-image-${KERNEL_VERSION} -y
Expand All @@ -28,18 +28,47 @@ if [ "${CURRENT_KERNEL}" != ${KERNEL_VERSION} ]; then
exit 1
fi

echo "update grub ..."
sudo sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${KERNEL_VERSION}\"/" /etc/default/grub
sudo cat /etc/default/grub | grep "GRUB_DEFAULT"
sudo update-grub
echo "update grub..."
# submenu menuentry kernel index calculation:
# init count=-2 due to
# 0-1 as "submenu 'Advanced options for ..." also included in count
# 0-1-1 as start index is 0 not 1
kernel_index=$(awk -v kernel_version="$KERNEL_VERSION" '
BEGIN {
count = -2
submenu_depth = 0
match_found = 0
}
/^submenu / {
submenu_depth++
}
# Match menuentry lines and match for the kernel version
/menuentry/ && submenu_depth > 0 && match_found == 0 {
count++
#print "Found match at Index " count ": " $0
if ($0 ~ kernel_version) {
print count
match_found = 1
}
}
/^}/ {
if (submenu_depth > 0) {
submenu_depth--
}
}
' "$GRUB_FILE")
sudo sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=\"1>${kernel_index}\"/" /etc/default/grub

echo "Rebooting ..."
# Run the reboot command with nohup to avoid abrupt SSH closure issues
nohup sudo reboot &

echo "--------------Installation of kernel completed --------------"
echo "--------------Kernel upgrade completed--------------"
else
echo "--------------Installation is not required, kernel is already on ${KERNEL_VERSION} --------------"
echo "--------------Kernel upgrade not required, current kernel version ${KERNEL_VERSION}--------------"
fi

# Exit with a success code since the reboot command was issued successfully
Expand Down
File renamed without changes.

0 comments on commit 7b746ba

Please sign in to comment.