squad 1.96__py3-none-any.whl → 1.97__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -392,9 +392,12 @@ class Backend(BaseBackend):
392
392
  if 'unknown' == results['results']['boot']:
393
393
  return None
394
394
 
395
- # Retrieve TuxRun log
395
+ # Retrieve plain text log
396
396
  logs = self.fetch_url(job_url + '/', 'logs?format=txt').text
397
- log_lines = logs.splitlines()
397
+
398
+ # Retrieve YAML log
399
+ log_structured = self.fetch_url(results["download_url"], 'lava-logs.yaml').text
400
+ log_data = yaml.safe_load(log_structured)
398
401
 
399
402
  attachment_list = ["reproducer", "tux_plan.yaml"]
400
403
  attachments = {}
@@ -410,6 +413,13 @@ class Backend(BaseBackend):
410
413
  boot_test_name = 'boot/' + (metadata.get('build_name') or 'boot')
411
414
  tests[boot_test_name] = {'result': results['results']['boot']}
412
415
 
416
+ lava_signal = re.compile("^<LAVA_SIGNAL_")
417
+
418
+ def filter_log(line):
419
+ return type(line["msg"]) is str \
420
+ and line["lvl"] == "target" \
421
+ and not lava_signal.match(line["msg"])
422
+
413
423
  # Really fetch test results
414
424
  tests_results = self.fetch_url(job_url + '/', 'results').json()
415
425
  if tests_results.get('error', None) is None:
@@ -417,16 +427,30 @@ class Backend(BaseBackend):
417
427
  suite_name = re.sub(r'^[0-9]+_', '', suite)
418
428
  for name, test_data in suite_tests.items():
419
429
  test_name = f'{suite_name}/{name}'
420
- result = test_data['result']
430
+ result = test_data.get('result')
431
+ if not result:
432
+ continue
421
433
  if "starttc" in test_data:
422
- starttc = test_data["starttc"] - 1 # LAVA data counts from 1, we count from 0
434
+ try:
435
+ # LAVA data counts from 1, we count from 0
436
+ starttc = int(test_data["starttc"]) - 1
437
+ except ValueError:
438
+ continue
423
439
  if "endtc" in test_data:
424
- # no -1 as the second index of the slice needs to be
425
- # greater than the first to get at least one item.
426
- endtc = test_data["endtc"]
440
+ try:
441
+ # no -1 as the second index of the slice needs to be
442
+ # greater than the first to get at least one item.
443
+ endtc = int(test_data["endtc"])
444
+ except ValueError:
445
+ endtc = starttc + 2
427
446
  else:
428
447
  endtc = starttc + 2
429
- log_snippet = "\n".join(log_lines[starttc:endtc])
448
+ log_lines = [
449
+ line["msg"].replace("\x00", "")
450
+ for line in log_data[starttc:endtc]
451
+ if filter_log(line)
452
+ ]
453
+ log_snippet = "\n".join(log_lines)
430
454
  else:
431
455
  log_snippet = None
432
456
  tests[test_name] = {"result": result, "log": log_snippet}
@@ -31,17 +31,24 @@ class Command(BaseCommand):
31
31
  type=str,
32
32
  help='Project to fetch the data into (Format: foo/bar)',
33
33
  )
34
+ parser.add_argument(
35
+ 'BUILD',
36
+ type=str,
37
+ nargs="?",
38
+ help='Build to fetch the data into',
39
+ )
34
40
 
35
41
  def handle(self, *args, **options):
36
42
  backend_name = options.get("BACKEND")
37
43
  job_id = options.get("JOBID")
38
44
  group_slug, project_slug = options.get("PROJECT").split('/')
45
+ _build = options.get("BUILD") or str(time.time())
39
46
 
40
47
  backend = Backend.objects.get(name=backend_name)
41
48
 
42
49
  group, _ = Group.objects.get_or_create(slug=group_slug)
43
50
  project, _ = group.projects.get_or_create(slug=project_slug)
44
- build = project.builds.create(version=str(time.time()))
51
+ build, _ = project.builds.get_or_create(version=_build)
45
52
 
46
53
  testjob = backend.test_jobs.create(target=project, job_id=job_id, target_build=build)
47
54
 
squad/frontend/views.py CHANGED
@@ -2,7 +2,9 @@ import json
2
2
  import mimetypes
3
3
 
4
4
  from django.db.models import Case, When, Prefetch, Max
5
+ from django.core.exceptions import PermissionDenied
5
6
  from django.core.paginator import Paginator, EmptyPage
7
+ from django.conf import settings
6
8
  from django.contrib.auth.decorators import login_required
7
9
  from django.http import HttpResponse, Http404
8
10
  from django.shortcuts import render, get_object_or_404, redirect, reverse
@@ -16,7 +18,7 @@ from squad.core.models import Build, Subscription, TestRun, SuiteMetadata, UserP
16
18
  from squad.core.queries import get_metric_data, test_confidence
17
19
  from squad.frontend.queries import get_metrics_list
18
20
  from squad.frontend.utils import file_type, alphanum_sort
19
- from squad.http import auth
21
+ from squad.http import auth, auth_user_from_request
20
22
  from collections import OrderedDict
21
23
 
22
24
 
@@ -76,6 +78,11 @@ def get_build_testrun_or_404(build, test_run_id):
76
78
 
77
79
  def home(request):
78
80
 
81
+ if settings.LOCK_HOME_PAGE:
82
+ user = auth_user_from_request(request, request.user)
83
+ if not user.is_authenticated:
84
+ raise PermissionDenied()
85
+
79
86
  ordering = request.GET.get('order')
80
87
  if ordering not in ['by_name', 'last_updated']:
81
88
  ordering = 'last_updated'
@@ -29,16 +29,23 @@ REGEXES = MULTILINERS + ONELINERS
29
29
 
30
30
  class Plugin(BasePlugin, BaseLogParser):
31
31
  def __cutoff_boot_log(self, log):
32
- # Attempt to split the log in " login:"
33
- logs = log.split(' login:', 1)
32
+ split_patterns = [r" login:", r"console:/", r"root@(.*):[/~]#"]
33
+ split_index = None
34
34
 
35
- # 1 string means no split was done, consider all logs as test log
36
- if len(logs) == 1:
37
- return '', log
35
+ for pattern in split_patterns:
36
+ match = re.search(pattern, log)
37
+ if match:
38
+ # Find the earliest split point
39
+ if split_index is None or match.start() < split_index:
40
+ split_index = match.start()
38
41
 
39
- boot_log = logs[0]
40
- test_log = logs[1]
41
- return boot_log, test_log
42
+ if split_index is not None:
43
+ boot_log = log[:split_index]
44
+ test_log = log[split_index:]
45
+ return boot_log, test_log
46
+
47
+ # No match found; return whole log as boot log
48
+ return log, ""
42
49
 
43
50
  def __kernel_msgs_only(self, log):
44
51
  kernel_msgs = re.findall(f'({tstamp}{pid}? .*?)$', log, re.S | re.M) # noqa
squad/settings.py CHANGED
@@ -444,6 +444,9 @@ DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760 # 10MB
444
444
  # Django requires that this specification is present in settings.py
445
445
  DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
446
446
 
447
+ # Force SQUAD to require login to access home page. This should reduce the risk of crawlers bots.
448
+ LOCK_HOME_PAGE = False
449
+
447
450
  try:
448
451
  from squad.local_settings import * # noqa: F401,F403
449
452
  except ImportError:
squad/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '1.96'
1
+ __version__ = '1.97'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: squad
3
- Version: 1.96
3
+ Version: 1.97
4
4
  Summary: Software Quality Dashboard
5
5
  Home-page: https://gitlab.com/Linaro/squad/squad
6
6
  Author: Antonio Terceiro
@@ -7,10 +7,10 @@ squad/http.py,sha256=KuIKtpf3yOvf5fwc0T2MR0ul1l4AKxq3b0CLdk6KBhM,3667
7
7
  squad/jinja2.py,sha256=Uv33jwWKhru5Z3vGVl5hxjyRZNHSdy9kMb8tyjFqzTU,2549
8
8
  squad/mail.py,sha256=xH5wuIpD7u1fTN9vNOcbzByojleaffsKwp-9i3BeOD0,390
9
9
  squad/manage.py,sha256=Z-LXT67p0R-IzwJ9fLIAacEZmU0VUjqDOSg7j2ZSxJ4,1437
10
- squad/settings.py,sha256=sLSts3qmUgXmpLmzhOBrTmFcSuBRMugo0hDY0uw4z3A,14792
10
+ squad/settings.py,sha256=gysDFsMJHzsV5hDbi-OWve6AS0FbsuWsJi5leFLmmdg,14914
11
11
  squad/socialaccount.py,sha256=vySqPwQ3qVVpahuJ-Snln8K--yzRL3bw4Nx27AsB39A,789
12
12
  squad/urls.py,sha256=JiEfVW8YlzLPE52c2aHzdn5kVVKK4o22w8h5KOA6QhQ,2776
13
- squad/version.py,sha256=RtXo-Lku2ipg-tPkVM1mzfGxoMi1VE4O6Qh-PRiKdWs,21
13
+ squad/version.py,sha256=Nv7EdV4kGSXOy7sQtXIc47xWRhrrf6PsmA2tlFoM6GA,21
14
14
  squad/wsgi.py,sha256=SF8T0cQ0OPVyuYjO5YXBIQzvSXQHV0M2BTmd4gP1rPs,387
15
15
  squad/api/__init__.py,sha256=CJiVakfAlHVN5mIFRVQYZQfuNUhUgWVbsdYTME4tq7U,1349
16
16
  squad/api/apps.py,sha256=Trk72p-iV1uGn0o5mdJn5HARUoHGbfgO49jwXvpkmdQ,141
@@ -33,12 +33,12 @@ squad/ci/backend/__init__.py,sha256=yhpotXT9F4IdAOXvGQ3-17eOHAFwoaqf9SnMX17ab30,
33
33
  squad/ci/backend/fake.py,sha256=MTsxGZuihJOd39X8ysJhiYp4A0R46lyhdkjoTgFm6a8,2435
34
34
  squad/ci/backend/lava.py,sha256=Atb2AgV5OSejtN1LyE7xONTFvJCdDoh9vK9RO_P7L2g,34077
35
35
  squad/ci/backend/null.py,sha256=oZx3OofUKSuLOYS_GZkteGaD6JOEEkdknVmi4_cxDOQ,5645
36
- squad/ci/backend/tuxsuite.py,sha256=7X7Ym4rWi6nUV01hio2wW-TYAOj5LHPFSZdor-lUivg,19944
36
+ squad/ci/backend/tuxsuite.py,sha256=roWaCHDenmyD0094jgTXhxXyZDtafNVQ9IXStcBxenc,20894
37
37
  squad/ci/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  squad/ci/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  squad/ci/management/commands/create_tuxsuite_boot_tests.py,sha256=JvjNusebLX71eyz9d-kaeCyekYSpzc1eXoeIqWK9ygo,4045
40
40
  squad/ci/management/commands/listen.py,sha256=3o0IZPeUz3D3Pd-yL-yJdYkRmSgm6mhzB8qUCt6oejU,4683
41
- squad/ci/management/commands/testfetch.py,sha256=28vOmmpgZFhJZRmXOCZxSN0y64fpLDCrmM7oi5rewk4,1663
41
+ squad/ci/management/commands/testfetch.py,sha256=pPFO74X5KCJMGr3OYt9bqijDQd_MAHRmc-bS3imMzwM,1875
42
42
  squad/ci/migrations/0001_initial.py,sha256=oIcEE32zdiuQkCyyily6VKnRVH8e03cYmvcxlo0iELg,2098
43
43
  squad/ci/migrations/0002_auto_20170406_1252.py,sha256=rLGNiNaV737vCVKtEOWTzdH4vkVlBdwfhYkkRdD7xps,633
44
44
  squad/ci/migrations/0003_backend_name.py,sha256=8erX-jJFSA-l9eefrWt4_sE7Qb3pVPDNjJJSqg_Mofk,512
@@ -310,7 +310,7 @@ squad/frontend/tests.py,sha256=PidrjaToK_Cks0s9Mc4i3Vh4UXOWoXTZlpnxQ2wWjHY,8740
310
310
  squad/frontend/urls.py,sha256=-rxbsUlMyxldzoVKiVAOMAREqU8SOipy4CqBTlULuMQ,5055
311
311
  squad/frontend/user_settings.py,sha256=U_i59iuylg98uH98K4ezPa2NY56idslBhn7MS6FguHQ,4976
312
312
  squad/frontend/utils.py,sha256=DeH58CJUI1dovpQrj3a-DcxNzM0cxsnBDOF0mrC4Qws,1364
313
- squad/frontend/views.py,sha256=9T9FPhFgzBuXaVu6D4oSPWZHeVU4OEr1kzj8asgya1U,27083
313
+ squad/frontend/views.py,sha256=OGmSNrru0KVt01F2hXkHRKh5PWAViOZVZGE25alObHU,27361
314
314
  squad/frontend/locale/django.pot,sha256=sPoU8HeTHDmzxvHFRDDXQiP-VH_jBC_p1-wXQMCMUDw,30192
315
315
  squad/frontend/locale/pl/LC_MESSAGES/django.po,sha256=vibPhqvDxcDhdtOttDNTIhQ6cctEm2zCbA1xAUNsbrw,36325
316
316
  squad/frontend/locale/pt/LC_MESSAGES/django.po,sha256=Fv_Amiw_2duq7QKYm5zQ17DudV1fuy2rZtf7VNKinek,36403
@@ -427,7 +427,7 @@ squad/plugins/__init__.py,sha256=9BSzy2jFIoDpWlhD7odPPrLdW4CC3btBhdFCvB651dM,152
427
427
  squad/plugins/example.py,sha256=BKpwd315lHRIuNXJPteibpwfnI6C5eXYHYdFYBtVmsI,89
428
428
  squad/plugins/gerrit.py,sha256=CqO2KnFQzu9utr_TQ-sGr1wg3ln0B-bS2-c0_i8T5-c,7009
429
429
  squad/plugins/github.py,sha256=pdtLZw_7xNuzkaFvY_zWi0f2rsMlalXjKm7sz0eADz4,2429
430
- squad/plugins/linux_log_parser.py,sha256=HQVreyZLBmLuv-K-MjlN43sQQSkcls4hkUsjJ9_5WfM,3472
430
+ squad/plugins/linux_log_parser.py,sha256=EU8JxVcehNXx1TdQ6yS9cPzkebaXEVn6C5UZpkL2INI,3775
431
431
  squad/plugins/linux_log_parser_build.py,sha256=Zc-wl20oBqkZbFyAHJzjdCm75t7dt112djroCvSWXxw,10593
432
432
  squad/plugins/lib/__init__.py,sha256=jzazbAvp2_ibblAs0cKZrmo9aR2EL3hKLyRDE008r2I,40
433
433
  squad/plugins/lib/base_log_parser.py,sha256=4qXAu6r9Bbsl9Ztn4r1n-uWesdOiHESXdzic2_voc8c,9551
@@ -436,9 +436,9 @@ squad/run/__main__.py,sha256=DOl8JOi4Yg7DdtwnUeGqtYBJ6P2k-D2psAEuYOjWr8w,66
436
436
  squad/run/listener.py,sha256=jBeOQhPGb4EdIREB1QsCzYuumsfJ-TqJPd3nR-0m59g,200
437
437
  squad/run/scheduler.py,sha256=CDJG3q5C0GuQuxwlMOfWTSSJpDdwbR6rzpbJfuA0xuw,277
438
438
  squad/run/worker.py,sha256=jtML0h5qKDuSbpJ6_rpWP4MT_rsGA7a24AhwGxBquzk,594
439
- squad-1.96.dist-info/licenses/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
440
- squad-1.96.dist-info/METADATA,sha256=SJVyM4OtL1m3jknZA9hIfO77bYhEEhBqj5xg3VHaXyw,1513
441
- squad-1.96.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
442
- squad-1.96.dist-info/entry_points.txt,sha256=apCDQydHZtvqV334ql6NhTJUAJeZRdtAm0TVcbbAi5Q,194
443
- squad-1.96.dist-info/top_level.txt,sha256=_x9uqE1XppiiytmVTl_qNgpnXus6Gsef69HqfliE7WI,6
444
- squad-1.96.dist-info/RECORD,,
439
+ squad-1.97.dist-info/licenses/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
440
+ squad-1.97.dist-info/METADATA,sha256=wFUjDHnIcxOB_S00MRThSO3i8P9F0BLwtqJCr2r0toc,1513
441
+ squad-1.97.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
442
+ squad-1.97.dist-info/entry_points.txt,sha256=apCDQydHZtvqV334ql6NhTJUAJeZRdtAm0TVcbbAi5Q,194
443
+ squad-1.97.dist-info/top_level.txt,sha256=_x9uqE1XppiiytmVTl_qNgpnXus6Gsef69HqfliE7WI,6
444
+ squad-1.97.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5