-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d74cbb
commit 7df2311
Showing
8 changed files
with
919 additions
and
189 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,21 @@ | ||
#!/usr/bin/env python3 | ||
"""takes results of compatibility tests and compie into one file""" | ||
|
||
import os | ||
import sys | ||
|
||
from compile_matrix import print_breakdowns | ||
|
||
|
||
def content_checker(filepath): | ||
return os.path.getsize(filepath) > 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
print("## Minimal Effort Compatibility") | ||
print( | ||
"Checks if `icloudpd` can be installed using minimal effort and ran bare minimum functionality of displaying a version information. Minimal effort may require installing default version of package manager using OS tools" | ||
) | ||
print("") | ||
folder = sys.argv[1] if len(sys.argv) > 1 else "." | ||
print_breakdowns(folder, content_checker, ("(src)", "Test pass using src (for pip)")) |
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,68 @@ | ||
"""takes results of compatibility tests and compile into one file""" | ||
|
||
import itertools | ||
import os | ||
|
||
|
||
def _stats(files): | ||
"""Print statistics""" | ||
total = len([f for f in files if f[4] != "na"]) | ||
passed = len([f for f in files if f[4] == "pass"]) | ||
print( | ||
f"Compatibility rate: {round(100*passed/total,1) if total > 0 else 0}% ({passed} passed out of {total})" | ||
) | ||
print("") | ||
|
||
|
||
def _matrix(files, special): | ||
"""Prints matrix""" | ||
archs = [ | ||
k for k, _ in itertools.groupby(sorted(files, key=lambda ft: ft[3]), key=lambda ft: ft[3]) | ||
] | ||
# sort by priority of archs | ||
presort = ["amd64", "arm64", "arm32v7"] | ||
archs_sorted = sorted(archs, key=lambda k: f"{presort.index(k) if k in presort else 9}{k}") | ||
# caption | ||
print("|".join(["OSes and distros"] + archs_sorted)) | ||
print("|".join(["-"] + ["-" for a in archs_sorted])) | ||
|
||
oses = [ | ||
k for k, _ in itertools.groupby(sorted(files, key=lambda ft: ft[2]), key=lambda ft: ft[2]) | ||
] | ||
for o in oses: | ||
results_raw = [ | ||
list(filter(lambda ft: ft[2] == o and ft[3] == a, files)) for a in archs_sorted | ||
] | ||
results = [ | ||
"N/A" | ||
if len(r) == 0 or r[0][4] == "na" | ||
else (r[0][4] + ("" if r[0][4] != "pass" or r[0][0] is False else f" {special}")) | ||
for r in results_raw | ||
] | ||
print("|".join([o] + results)) | ||
|
||
|
||
def print_breakdowns(folder, special_content_checker, special_pair): | ||
"""param: folder""" | ||
(abbr, description) = special_pair | ||
files = [f for f in os.listdir(folder) if not os.path.isdir(f)] | ||
fts = [ | ||
[special_content_checker(os.path.join(folder, f))] + f.split(".") | ||
for f in files | ||
if len(f.split(".")) == 4 | ||
] | ||
_stats(fts) | ||
print("Legend:") | ||
print("- N/A - not applicable/available") | ||
print("- pass - test pass") | ||
print("- fail - test fail") | ||
print(f"- pass {abbr} - {description}") | ||
print("") | ||
groups = [ | ||
(k, list(g)) | ||
for k, g in itertools.groupby(sorted(fts, key=lambda ft: ft[1]), key=lambda ft: ft[1]) | ||
] | ||
for g, f in groups: | ||
print(f"### {g}") | ||
_stats(f) | ||
_matrix(f, abbr) |
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,35 @@ | ||
#!/usr/bin/env python3 | ||
"""takes results of tz and locale compatibility tests and compile into one file""" | ||
|
||
import sys | ||
|
||
from compile_matrix import print_breakdowns | ||
|
||
|
||
def special_content_checker(expected_content): | ||
# content is special when it exists, but is invalid | ||
def _intern(filepath): | ||
with open(filepath, encoding="UTF-8") as file: | ||
content = file.read() | ||
return content != expected_content | ||
|
||
return _intern | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 3: | ||
print("Params: <folder> <expected content>") | ||
sys.exit(1) | ||
print("## Timezone and Locale Compatibility") | ||
print( | ||
"Checks if `icloudpd` can be installed using minimal effort and ran bare minimum functionality of displaying version and commit timestamp in local timezone and RU locale. Minimal effort may require installing default version of package manager, timezone data, and locales using OS tools" | ||
) | ||
print("") | ||
folder = sys.argv[1] | ||
expected_content = sys.argv[2] | ||
# content is special when it exists, but is invalid | ||
print_breakdowns( | ||
folder, | ||
special_content_checker(expected_content), | ||
("(invalid)", "Incorrect values were generated"), | ||
) |
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,11 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
if [ `which npx` ]; then | ||
echo "test icloudpd..." && | ||
npx ${@:3} && | ||
touch $1 | ||
else | ||
echo "No npx available" | ||
touch $2 | ||
fi |