mirror of
				https://github.com/vyos/vyos-build.git
				synced 2025-10-01 20:28:40 +02:00 
			
		
		
		
	Testsuite: T861: use variable to define one single place for VM name
This commit is contained in:
		
							parent
							
								
									aa6ca5c65b
								
							
						
					
					
						commit
						986b71af2d
					
				| @ -50,6 +50,7 @@ from datetime import datetime | |||||||
| EXCEPTION = 0 | EXCEPTION = 0 | ||||||
| now = datetime.now() | now = datetime.now() | ||||||
| tpm_folder = '/tmp/vyos_tpm_test' | tpm_folder = '/tmp/vyos_tpm_test' | ||||||
|  | qemu_name = 'VyOS-QEMU' | ||||||
| 
 | 
 | ||||||
| parser = argparse.ArgumentParser(description='Install and start a test VyOS vm.') | parser = argparse.ArgumentParser(description='Install and start a test VyOS vm.') | ||||||
| parser.add_argument('iso', help='ISO file to install') | parser.add_argument('iso', help='ISO file to install') | ||||||
| @ -279,7 +280,7 @@ def start_swtpm(): | |||||||
|     return tpm_process |     return tpm_process | ||||||
| 
 | 
 | ||||||
| if args.qemu_cmd: | if args.qemu_cmd: | ||||||
|     tmp = get_qemu_cmd('TESTVM', args.uefi, args.disk, diskname_raid, args.iso) |     tmp = get_qemu_cmd(qemu_name, args.uefi, args.disk, diskname_raid, args.iso) | ||||||
|     os.system(tmp) |     os.system(tmp) | ||||||
|     exit(0) |     exit(0) | ||||||
| 
 | 
 | ||||||
| @ -290,7 +291,7 @@ try: | |||||||
|     # Installing image to disk |     # Installing image to disk | ||||||
|     ################################################# |     ################################################# | ||||||
|     log.info('Installing system') |     log.info('Installing system') | ||||||
|     cmd = get_qemu_cmd('TESTVM', args.uefi, args.disk, diskname_raid, args.iso) |     cmd = get_qemu_cmd(qemu_name, args.uefi, args.disk, diskname_raid, args.iso) | ||||||
|     log.debug(f'Executing command: {cmd}') |     log.debug(f'Executing command: {cmd}') | ||||||
|     c = pexpect.spawn(cmd, logfile=stl, timeout=60) |     c = pexpect.spawn(cmd, logfile=stl, timeout=60) | ||||||
| 
 | 
 | ||||||
| @ -488,7 +489,7 @@ try: | |||||||
| 
 | 
 | ||||||
|         # Booting back into VM |         # Booting back into VM | ||||||
|         log.info('Booting TPM-backed system') |         log.info('Booting TPM-backed system') | ||||||
|         cmd = get_qemu_cmd('TESTVM', args.uefi, args.disk, diskname_raid, tpm=args.tpmtest) |         cmd = get_qemu_cmd(qemu_name, args.uefi, args.disk, diskname_raid, tpm=args.tpmtest) | ||||||
|         log.debug(f'Executing command: {cmd}') |         log.debug(f'Executing command: {cmd}') | ||||||
|         c = pexpect.spawn(cmd, logfile=stl) |         c = pexpect.spawn(cmd, logfile=stl) | ||||||
| 
 | 
 | ||||||
| @ -523,7 +524,7 @@ try: | |||||||
| 
 | 
 | ||||||
|         # Booting back into VM |         # Booting back into VM | ||||||
|         log.info('Booting system with cleared TPM') |         log.info('Booting system with cleared TPM') | ||||||
|         cmd = get_qemu_cmd('TESTVM', args.uefi, args.disk, diskname_raid, tpm=args.tpmtest) |         cmd = get_qemu_cmd(qemu_name, args.uefi, args.disk, diskname_raid, tpm=args.tpmtest) | ||||||
|         log.debug(f'Executing command: {cmd}') |         log.debug(f'Executing command: {cmd}') | ||||||
|         c = pexpect.spawn(cmd, logfile=stl) |         c = pexpect.spawn(cmd, logfile=stl) | ||||||
| 
 | 
 | ||||||
| @ -575,7 +576,7 @@ try: | |||||||
|         # Booting RAID-1 system with one missing disk |         # Booting RAID-1 system with one missing disk | ||||||
|         ################################################# |         ################################################# | ||||||
|         log.info('Booting RAID-1 system') |         log.info('Booting RAID-1 system') | ||||||
|         cmd = get_qemu_cmd('TESTVM', args.uefi, args.disk, diskname_raid) |         cmd = get_qemu_cmd(qemu_name, args.uefi, args.disk, diskname_raid) | ||||||
| 
 | 
 | ||||||
|         # We need to swap boot indexes to boot from second harddisk so we can |         # We need to swap boot indexes to boot from second harddisk so we can | ||||||
|         # recreate the RAID on the first disk |         # recreate the RAID on the first disk | ||||||
| @ -625,7 +626,7 @@ try: | |||||||
|         shutdownVM(c, log, f'Shutdown VM and start from recovered RAID member "{args.disk}"') |         shutdownVM(c, log, f'Shutdown VM and start from recovered RAID member "{args.disk}"') | ||||||
| 
 | 
 | ||||||
|         log.info('Booting RAID-1 system') |         log.info('Booting RAID-1 system') | ||||||
|         cmd = get_qemu_cmd('TESTVM', args.uefi, args.disk, diskname_raid) |         cmd = get_qemu_cmd(qemu_name, args.uefi, args.disk, diskname_raid) | ||||||
|         log.debug(f'Executing command: {cmd}') |         log.debug(f'Executing command: {cmd}') | ||||||
|         c = pexpect.spawn(cmd, logfile=stl) |         c = pexpect.spawn(cmd, logfile=stl) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user