Compare commits

..

No commits in common. "dae37954b386e43435f9b42470b41af3302ec6fa" and "f0435961cb77e8f4f80b227e92d39d81f45c9d64" have entirely different histories.

View file

@ -58,27 +58,16 @@ def get_device_info(device):
output = subprocess.run( output = subprocess.run(
f"sudo smartctl -i {device}", shell=True, capture_output=True, text=True f"sudo smartctl -i {device}", shell=True, capture_output=True, text=True
).stdout ).stdout
model = serial = "unknown" model = serial = "unknown"
for line in output.splitlines(): for line in output.splitlines():
if any(x in line for x in ["Device Model", "Model Number", "Product"]): if any(x in line for x in ["Device Model", "Model Family", "Model Number"]):
model = line.split(":", 1)[-1].strip().replace(" ", "_") model = line.split(":", 1)[-1].strip().replace(" ", "_")
elif "Vendor:" in line and model == "unknown": elif "Serial Number" in line:
vendor = line.split(":", 1)[-1].strip().replace(" ", "_")
model = vendor # temporary, could be combined later
elif "Serial Number" in line or "Serial number" in line:
serial = line.split(":", 1)[-1].strip() serial = line.split(":", 1)[-1].strip()
elif "Logical Unit id" in line and serial == "unknown":
serial = line.split()[-1].strip()
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
if model == "unknown" or serial == "unknown": if model == "unknown" or serial == "unknown":
print("Failed to extract model or serial. Using timestamp for filename.") print("Failed to extract model or serial. Using timestamp for filename.")
return f"drive_test_{timestamp}.log" return f"drive_test_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log"
return f"{model}_{serial}_test.log"
return f"{model}_{serial}_test_{timestamp}.log"
def show_smart_info(device, log_file): def show_smart_info(device, log_file):
@ -121,7 +110,7 @@ def fill_random(device, log_file):
print("Random data write complete.") print("Random data write complete.")
def run_fio(device, rw_mode, log_file, bs="4k", runtime=60): def run_fio(device, rw_mode, log_file, bs="4k", runtime=30):
print(f"Running fio test: {rw_mode}") print(f"Running fio test: {rw_mode}")
cmd = ( cmd = (
f"sudo fio --name={rw_mode}_test " f"sudo fio --name={rw_mode}_test "
@ -163,7 +152,7 @@ def main():
run_fio(device, "read", log_file) run_fio(device, "read", log_file)
run_fio(device, "randread", log_file) run_fio(device, "randread", log_file)
run_fio(device, "randwrite", log_file) run_fio(device, "randwrite", log_file)
run_fio(device, "randread", log_file, bs="512", runtime=30) # IOPS test run_fio(device, "randread", log_file, bs="512", runtime=10) # IOPS test
print(f"\nTest completed. Results saved to {log_filename}") print(f"\nTest completed. Results saved to {log_filename}")