8.7 KiB
KernelSU Anti-Bootloop Backup System: Testing Guide
This guide outlines test scenarios to verify the functionality of the backup and restoration system. Each test should be performed in a controlled environment before deploying to production devices.
Test Environment Setup
Before running any tests, ensure you have:
- A test device with KernelSU installed
- The backup module properly installed
- Root access verified
- At least 2GB of free storage space
- A secondary storage location (SD card or USB) for storage adapter tests
- A way to intentionally cause a controlled boot issue (for recovery testing)
Basic Functionality Tests
Module Installation Test
- Install the module via KernelSU Manager
- Reboot the device
- Verify module appears as active in KernelSU Manager
- Run initialization:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh init" - Check for any errors in logs:
cat /data/adb/modules/kernelsu_antibootloop_backup/config/logs/integration.log
Component Availability Test
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh check"
Expected result: All components should be reported as available.
WebUI Test
- Start the web server:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/webui-server.sh start" - Navigate to
http://localhost:8080on device or via ADB forwarding - Verify all UI elements load correctly
- Verify navigation between sections works
Backup Creation Tests
Full System Backup Test
- Create a full system backup:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-full 'Test full backup' local false" - Verify backup ID is returned
- Check backup appears in backup list:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh list-backups" - Verify backup details:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-details BACKUP_ID"
App Backup Test
- Create an app backup with multiple packages:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-app 'com.android.settings,com.android.calculator2' 'Test app backup' local" - Verify backup ID is returned
- Check backup appears in backup list
- Verify app data is included in the backup
Settings Backup Test
- Create a settings backup:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-settings 'Test settings backup' local" - Verify backup ID is returned
- Check backup appears in backup list
Encrypted Backup Test
- Create an encrypted full backup:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-full 'Test encrypted backup' local true" - Verify backup ID is returned
- Check backup appears in backup list
- Verify encryption status in backup details
Storage Adapter Tests
External Storage Test
- Insert SD card
- Create a backup to external storage:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-full 'Test external backup' external false" - Verify backup is created on SD card
- List backups from external storage to confirm
USB Storage Test
- Connect USB storage via OTG
- Create a backup to USB storage:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-full 'Test USB backup' usb false" - Verify backup is created on USB storage
- List backups from USB storage to confirm
Network Storage Test (if configured)
- Configure network storage in settings
- Create a backup to network storage:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh backup-full 'Test network backup' network false" - Verify backup is uploaded to network location
- List backups from network storage to confirm
Restoration Tests
Full Restoration Test
- Create a full backup
- Make some system changes (install app, change settings)
- Restore the full backup:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh restore BACKUP_ID" - Verify system returns to the pre-change state
Selective Restoration Test
- Create a full backup
- Make changes to apps and settings
- Restore only settings component:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh restore BACKUP_ID settings" - Verify only settings are restored
- Restore only apps component:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh restore BACKUP_ID apps" - Verify only apps are restored
Encrypted Backup Restoration Test
- Create an encrypted backup
- Make system changes
- Restore from encrypted backup:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh restore BACKUP_ID" - Verify restoration completes successfully
Differential Backup Tests
Incremental Backup Test
- Create an initial full backup
- Make some system changes
- Create another backup with the same description
- Verify the second backup is smaller than the first (differential)
- Restore from the second backup
- Verify all changes are properly restored
Compression Test
Create backups with different content types (text-heavy apps vs. media-heavy apps) and verify compression effectiveness by checking backup sizes.
Schedule Tests
Time-Based Schedule Test
- Create a schedule to run in a few minutes:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh create-schedule 'Test Schedule' 'custom:5m' 'default'" - Wait for the scheduled time
- Verify backup is created automatically
- Check for notification
Boot-Based Schedule Test
- Create a schedule to run at boot:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/scripts/backup-integration.sh create-schedule 'Boot Schedule' 'boot' 'default'" - Reboot the device
- Verify backup is created automatically after boot
Recovery Tests
Anti-Bootloop Recovery Test
CAUTION: This test should only be performed on test devices with data backed up elsewhere.
- Create a full system backup
- Intentionally cause a boot issue:
- Install a problematic app known to cause boot loops
- Or modify a system file to cause boot failure
- Attempt to boot the device
- Verify the anti-bootloop protection activates
- Verify automatic restoration from the backup
- Verify device returns to normal operation
Manual Recovery Test
- Create a full system backup
- Enter recovery mode
- Use the recovery script to restore the backup
- Verify system is restored correctly
Performance Tests
Large System Test
Create a full system backup on a device with many apps installed and verify backup and restore operations complete within reasonable time frames.
Resource Usage Test
Monitor CPU, memory, and battery usage during backup and restore operations to ensure the system operates efficiently.
Error Handling Tests
Insufficient Space Test
- Fill device storage to near capacity
- Attempt to create a backup
- Verify appropriate error message
- Verify system remains stable
Corrupt Backup Test
- Create a backup
- Manually corrupt the backup file
- Attempt to restore from corrupt backup
- Verify appropriate error handling
- Verify system remains stable
Security Tests
Encryption Verification
- Create an encrypted backup
- Attempt to manually decrypt the backup file without proper keys
- Verify this is not possible
- Restore using the proper process
- Verify restoration succeeds
Permission Test
- Attempt to run backup operations without root (remove
su -c) - Verify appropriate permission errors
- Verify system remains secure
Reporting Test Results
For each test:
- Document the test name and procedure followed
- Record whether the test passed or failed
- Note any unexpected behavior or errors
- Include logs if errors occurred
- Document the device model and Android version
Submit test results to the development team for analysis and improvement.
Automated Testing
For developers, shell scripts for automated testing are available in:
/data/adb/modules/kernelsu_antibootloop_backup/tests/
Run the automated test suite:
su -c "sh /data/adb/modules/kernelsu_antibootloop_backup/tests/run-tests.sh"