Skip to content

Commit

Permalink
feat: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zjregee committed Aug 18, 2024
1 parent c66add7 commit 8f18b8c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/scripts/behavior_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import paramiko
import time

hostname = "localhost"
port = 2222
username = "ubuntu"
password = "ubuntu"

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

# Wait for the VM to boot.
time.sleep(5 * 60)

try:
ssh.connect(hostname=hostname, port=port, username=username, password=password)
sudo_command = "sudo -S mount -t virtiofs myfs /mnt"

stdin, stdout, stderr = ssh.exec_command(sudo_command)

stdin.write(password + '\n')
stdin.flush()

output = stdout.read().decode('utf-8')
errors = stderr.read().decode('utf-8')

print("mount done")

finally:
ssh.close()
7 changes: 4 additions & 3 deletions .github/scripts/install_and_run_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 4G \
sudo umount /mnt/ubuntu-iso
sudo rm -rf /mnt/ubuntu-iso

sudo qemu-system-x86_64 -M pc -cpu host --enable-kvm -smp 2 \
sudo qemu-system-x86_64 --enable-kvm -smp 2 \
-m 4G -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on -numa node,memdev=mem \
-chardev socket,id=char0,path=/tmp/vfsd.sock -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs \
-chardev stdio,mux=on,id=mon -mon chardev=mon,mode=readline -device virtio-serial-pci -device virtconsole,chardev=mon -vga none -display none \
-drive file=image.img,format=raw,cache=none,if=virtio
-drive file=image.img,format=raw,cache=none,if=virtio \
-net user,hostfwd=tcp::2222-:22 -net nic \
-nographic -boot c
7 changes: 6 additions & 1 deletion .github/workflows/behavior_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@ jobs:
chmod +x ./build_and_run_ovfs.sh
chmod +x ./install_and_run_vm.sh
nohup ./build_and_run_ovfs.sh &
./install_and_run_vm.sh
nohup ./install_and_run_vm.sh &
working-directory: .github/scripts

- name: Run Behavior Test
run: |
python behavior_test.py
working-directory: .github/scripts

0 comments on commit 8f18b8c

Please sign in to comment.