Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add built in testing #167

Merged
merged 72 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
ee4e44a
Add built-in test plan
linknum23 Aug 4, 2021
f88bf14
Add set_zones command
linknum23 Aug 13, 2021
8d6f519
Cleanup
linknum23 Aug 16, 2021
167d8cc
Add load_config and reset endpoints
linknum23 Aug 16, 2021
e914a47
Make basic led test work
linknum23 Aug 18, 2021
dccb0c3
Add built-in tests
linknum23 Aug 19, 2021
8da86c6
Fix bug in load preset
linknum23 Aug 20, 2021
c917224
Add preamp test
linknum23 Aug 24, 2021
cdd71e5
Add configuration for connecting analog inputs
linknum23 Aug 24, 2021
5e26ebd
Make source id field match existing naming conventions
linknum23 Aug 25, 2021
c7c05dc
Adjust volumes for test
linknum23 Aug 25, 2021
2b9961d
Add delay so config file gets written
linknum23 Aug 25, 2021
2718fac
Fix lingering references to src_id field
linknum23 Aug 26, 2021
37f9df1
Plumb set_zones into the api
linknum23 Aug 26, 2021
6e88c08
Add basic Save button to download AmpliPi's current config
linknum23 Aug 26, 2021
579ae7f
Add reset
linknum23 Aug 26, 2021
275e2da
Add config upload and seperate load/save/reset
linknum23 Aug 27, 2021
073e644
Fix typo
linknum23 Aug 30, 2021
20eaeb6
Test fix for internet radio
linknum23 Aug 30, 2021
0c60251
Add start of test checklist
linknum23 Aug 30, 2021
0799e4c
Close i2c during reset
linknum23 Aug 30, 2021
f4da8d3
Add more test documentation
linknum23 Sep 1, 2021
9db2c50
Combine and trim test audio
Lohrer Sep 1, 2021
9ac9d03
Adapt preamp test to merged left and right files
linknum23 Sep 1, 2021
aadb7f8
Make digital outputs a little more audible
linknum23 Sep 1, 2021
b661e11
Move hardware test documentation
linknum23 Sep 1, 2021
38c325d
Update audio tests
linknum23 Sep 1, 2021
bc867ee
Add vollibrespot and gmrender to gitignore
Lohrer Sep 2, 2021
8a41e33
Added display test
Lohrer Sep 2, 2021
9f40641
Make amplipi service restart on other types of failures
linknum23 Sep 2, 2021
ceca4a2
Add start of inputs_test for controller
linknum23 Sep 2, 2021
092c52d
Add documentation for how to generate audio files
linknum23 Sep 2, 2021
4a22f7c
Added Ethernet test
Lohrer Sep 3, 2021
9ccd5ef
Add aux and optical in audio files for testing
linknum23 Sep 3, 2021
3bbbc2b
Add inputs test
linknum23 Sep 3, 2021
dd4b68a
Only install vollibresport once for now
linknum23 Sep 3, 2021
b79f9e4
Robustify audio test scripts
linknum23 Sep 3, 2021
33155d5
Add start of installing desktop icons for tests
linknum23 Sep 3, 2021
cac4687
Add single desktop icon for tests, more to come
linknum23 Sep 10, 2021
a97b0b1
Differentiate between amp and preout tests
linknum23 Sep 10, 2021
1261d4f
Add more test icons
linknum23 Sep 10, 2021
ba2fb79
Only remove vollibrespot on an install
linknum23 Sep 10, 2021
7974256
Add suport for using the debug server on the aptestanalog tester supp…
linknum23 Sep 13, 2021
d3e2960
Add udev rule to robustify alsa usb device identification
linknum23 Sep 13, 2021
e155205
Add preliminary instructions for built in tests
linknum23 Sep 13, 2021
11c44df
Cleanup Desktop file creation
Lohrer Sep 14, 2021
874d096
Fix soundcard ID udev rule installation
Lohrer Sep 14, 2021
15fec69
Add display and Ethernet test desktop shortcuts
Lohrer Sep 14, 2021
31a7b21
Update TESTING.md and add Program Preamp desktop icon
Lohrer Sep 15, 2021
dab2563
Only add tests on AmpliPi
Lohrer Sep 15, 2021
abf81cc
Increase display's AmpliPi status timeout
Lohrer Sep 15, 2021
9c20536
Add usb test script
linknum23 Sep 15, 2021
e8fd6d8
Cleanup api interface
linknum23 Sep 15, 2021
7b26bd5
Move built in tests to hw
linknum23 Sep 15, 2021
e4d06e8
Update testing docs
linknum23 Sep 16, 2021
2d35282
Make ALSA mixer commands try the first 4 cards since we don't know wh…
linknum23 Sep 16, 2021
3059396
Fix various missing files
linknum23 Sep 16, 2021
86348ef
Force copy in case shairport is running
linknum23 Sep 16, 2021
271fb75
Add notes for later
linknum23 Sep 16, 2021
70fd966
Fic more alsa problems for input test
linknum23 Sep 16, 2021
437ec07
Add USB reset to apply usb audio name without reset
linknum23 Sep 16, 2021
01eb6ea
Cleanup output
linknum23 Sep 16, 2021
2b3541f
Add graceful exit
linknum23 Sep 16, 2021
78451db
Fix typo
linknum23 Sep 16, 2021
335f0e9
Update test sheet/procedure
linknum23 Sep 16, 2021
8cb5bb8
Add checkbox placeholder for table formatting
linknum23 Sep 17, 2021
d7154ec
Improve testing form based on Jason's feedback
linknum23 Sep 17, 2021
a26a721
Fix exit handling
linknum23 Sep 17, 2021
961bd8e
Add testing for connected extender (should work without as well)
linknum23 Sep 17, 2021
4691bd7
Cleanup tests
linknum23 Sep 17, 2021
f481e1e
Force flashing a fixed number of units
Lohrer Sep 17, 2021
a2fc646
Emphasize zone 7 expansion test
linknum23 Sep 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add built-in tests
  • Loading branch information
linknum23 authored and Lohrer committed Sep 15, 2021
commit dccb0c30518438ab4b3bc0970056269c44463828
22 changes: 19 additions & 3 deletions amplipi/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from enum import Enum
from time import sleep
from typing import Optional
import argparse
import requests

from amplipi import models
Expand All @@ -30,6 +31,10 @@ class Client:
def __init__(self):
self.url = 'http://localhost/api'

def reset(self) -> bool:
""" Rest HW """
return requests.post(f'{self.url}/reset').ok

def load_config(self, cfg: models.Status) -> Optional[models.Status]:
""" Load a configuration """
resp = requests.post(f'{self.url}/load', json=cfg.dict())
Expand Down Expand Up @@ -124,18 +129,29 @@ def loop_test(client: Client, test_name: str):
if status is None:
return
stages = [pst for pst in status.presets if pst.name.startswith(test_name) and pst.id is not None]
if len(stages) == 0:
print(f"test '{test_name}' not found")
return
print(f"Running test '{test_name}'. Press Ctrl-C to stop.")
try:
while True:
for stage in stages:
if stage.id is not None: # placate the typechecker
client.load_preset(stage.id)
sleep(1)
sleep(3)
sleep(1)
if test_name == 'led':
client.reset() # reset amplipi since fw can lock up during unplugging/plugging in led board
except:
pass


if __name__ == '__main__':

parser = argparse.ArgumentParser('Test audio functionality')
parser.add_argument('test', help='Test to run (led,zones)')
args = parser.parse_args()

print('configuring amplipi for testing (TODO: unconfigure it when done!)')
ap = Client()
setup(ap)
loop_test(ap, 'led')
loop_test(ap, args.test)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include = [
"config/*.conf",
"debs/**/*",
"fw/preamp_*", # no need to add full source tree
"scripts/run_debug_webserver", "scripts/run_debug_updater", "scripts/configure.py", "scripts/install_python_deps.bash", # other scripts only support development
"scripts/run_debug_webserver", "scripts/run_debug_updater", "scripts/configure.py", "scripts/install_python_deps.bash", "scripts/built_in_test", # other scripts only support development
"streams/**/*",
"web/**/*",
"bin/**",
Expand Down
11 changes: 11 additions & 0 deletions scripts/built_in_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# call the built in tests python script, passing all of the args

set -e

# get directory that the script exists in
cd "$( dirname "$0" )/.."

# use our virtual environment
source venv/bin/activate
./venv/bin/python -m amplipi.tests $@ # pass through all of the args