From 2434818013fc89a1f35057b6a2ad16e685090ed9 Mon Sep 17 00:00:00 2001 From: spenc3rb Date: Thu, 27 Feb 2025 12:25:40 -0700 Subject: [PATCH] new format for QA --- .../{software-testing.md => README.md} | 0 Testing/Software/assets/logs/README.md | 13 +++++ Testing/Software/test_configurations.py | 32 ----------- Testing/Software/test_git_installs.py | 26 --------- Testing/Software/test_packages.py | 53 ------------------- 5 files changed, 13 insertions(+), 111 deletions(-) rename Testing/Software/{software-testing.md => README.md} (100%) create mode 100644 Testing/Software/assets/logs/README.md delete mode 100644 Testing/Software/test_configurations.py delete mode 100644 Testing/Software/test_git_installs.py delete mode 100644 Testing/Software/test_packages.py diff --git a/Testing/Software/software-testing.md b/Testing/Software/README.md similarity index 100% rename from Testing/Software/software-testing.md rename to Testing/Software/README.md diff --git a/Testing/Software/assets/logs/README.md b/Testing/Software/assets/logs/README.md new file mode 100644 index 0000000..751e646 --- /dev/null +++ b/Testing/Software/assets/logs/README.md @@ -0,0 +1,13 @@ +# Quality Assurance Logs + +This directory contains logs of the quality assurance process for the UTHP software. The logs are organized by date and time, and contain information about the testing process, including the test cases, test results, and unique identifiers for the test runs. + +> To add a new log file, create a new directory with the name of the UTHP (UTHP-R1-XXXX) and copy the contents of the log results to that directory. + +## QA entry format: + +| Date | Time | UTHP Serial Number | Test Results | Test Cases | Test Run ID | +|------------|------|--------------------|--------------|------------|-------------| +| 2021-08-01 | 12:00| UTHP-R1-XXXX | PASS/FAIL | X | core | + +## Test Results: \ No newline at end of file diff --git a/Testing/Software/test_configurations.py b/Testing/Software/test_configurations.py deleted file mode 100644 index 80b786a..0000000 --- a/Testing/Software/test_configurations.py +++ /dev/null @@ -1,32 +0,0 @@ -import pytest -import subprocess - -def read_sysfs_file(path): - """Helper function to read content from a sysfs file.""" - try: - with open(path, 'r') as file: - return file.read().strip() - except Exception as e: - pytest.fail(f"Failed to read {path}: {str(e)}") - -def check_interface_enabled(interface_path): - """Check if a given interface (I2C, SPI, UART) is enabled by reading sysfs or configfs.""" - content = read_sysfs_file(interface_path) - return content.lower() in ['1', 'enabled', 'true', 'yes'] - -@pytest.mark.parametrize("pin_config,expected_value", [ - ("/sys/kernel/debug/pinctrl/44e10800.pinmux/pins_pin_24", "0x32"), # Adjust path and value - ("/sys/kernel/debug/pinctrl/44e10800.pinmux/pins_pin_28", "0x32") # for actual CAN0 and CAN1 settings -]) -def test_pin_muxing(pin_config, expected_value): - """Test pin muxing settings for CAN interfaces.""" - assert read_sysfs_file(pin_config) == expected_value, f"Pin configuration for {pin_config} should be {expected_value}" - -@pytest.mark.parametrize("interface,enabled", [ - ("/sys/class/i2c-adapter/i2c-0/status", "enabled"), # Example path, adjust as necessary - ("/sys/class/spi-master/spi0/status", "enabled"), - ("/sys/class/tty/ttyO0/status", "enabled") # Example for UART, adjust path as needed -]) -def test_interface_enabled(interface, enabled): - """Test whether interfaces like I2C, SPI, and UART are enabled.""" - assert check_interface_enabled(interface), f"{interface} should be enabled" diff --git a/Testing/Software/test_git_installs.py b/Testing/Software/test_git_installs.py deleted file mode 100644 index 0f280da..0000000 --- a/Testing/Software/test_git_installs.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -import pytest - -def is_git_repository(path): - """Check if a directory contains a .git subdirectory indicating it's a Git repository.""" - return os.path.isdir(os.path.join(path, '.git')) - -@pytest.mark.parametrize("project", [ - "BBB_Variants", - "jupyter-lab", - "canmatrix", - "cmap", - "scapy", - "python-j1939", - "TruckDevil", - "cancat", - "pretty-j1939", - "pretty-j1587", - "sigrok", - "can2", - "canelloni" -]) -def test_git_clone(project): - """Test if specific projects have been cloned into /home/debian/.""" - project_path = f"/home/debian/{project}" - assert is_git_repository(project_path), f"{project} should be a Git repository at {project_path}" diff --git a/Testing/Software/test_packages.py b/Testing/Software/test_packages.py deleted file mode 100644 index b36d211..0000000 --- a/Testing/Software/test_packages.py +++ /dev/null @@ -1,53 +0,0 @@ -import subprocess -import pytest - -def check_package_installed(package): - """Utility function to check if a package is installed via dpkg.""" - try: - subprocess.run(['dpkg', '-s', package], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - return True - except subprocess.CalledProcessError: - return False - -def check_command_version(command, expected_version): - """Utility function to check a command's version.""" - try: - result = subprocess.run([command, '--version'], stdout=subprocess.PIPE, text=True) - return expected_version in result.stdout - except Exception: - return False - -@pytest.mark.parametrize("package", [ - "python2", - "python3", - "ipython3", - "can-utils", - "curl", - "wget", - "nginx", - "dhcpd", # Ensure DHCP server package, adjust name if necessary - "apache2" # Assuming 'httpd' refers to Apache HTTP Server -]) -def test_dpkg_package_installed(package): - """Test that essential dpkg packages are installed.""" - assert check_package_installed(package), f"Package {package} should be installed via dpkg" - -def test_ip_command_version(): - """Test that the IP command is the correct version.""" - assert check_command_version('ip', 'ip utility, iproute2-ss'), "IP command should be from iproute2-ss version 2" - -def test_nginx_running(): - """Test if the Nginx service is running.""" - assert subprocess.run(['systemctl', 'is-active', 'nginx'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - -def test_httpd_running(): - """Test if the Apache HTTP Server (httpd) is running.""" - assert subprocess.run(['systemctl', 'is-active', 'apache2'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - -def test_dhcp_running(): - """Test if the DHCP server is running.""" - assert subprocess.run(['systemctl', 'is-active', 'isc-dhcp-server'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - -def test_nginx_configuration(): - """Test that Nginx configuration is valid.""" - assert subprocess.run(['nginx', '-t'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)