-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I0833f4921657f9cfcfe99618372a87785ffc7128
- Loading branch information
Showing
2 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
import glob | ||
import json | ||
import unittest | ||
|
||
|
||
class HudsonTestCase(unittest.TestCase): | ||
def test_build_targets(self): | ||
models_json = set() | ||
|
||
with open("updater/devices.json", "r") as f: | ||
for device in json.load(f): | ||
models_json.add(device["model"]) | ||
|
||
models_hudson = set() | ||
|
||
with open("lineage-build-targets", "r") as f: | ||
for line in f.readlines(): | ||
line = line.strip() | ||
|
||
if not line or line.startswith("#"): | ||
continue | ||
|
||
model, _, _, _ = line.split() | ||
models_hudson.add(model) | ||
|
||
models_missing = models_hudson - models_json | ||
|
||
if models_missing: | ||
self.fail(f"Missing models in devices.json: {', '.join(models_missing)}") | ||
|
||
def test_json(self): | ||
for file in glob.glob("updater/*.json"): | ||
with open(file, "r") as f: | ||
try: | ||
json.load(f) | ||
except json.JSONDecodeError as e: | ||
self.fail(f"Failed to load {file}") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |