Skip to content

ci: add test result upload#1380

Merged
fslongjin merged 1 commit intomasterfrom
ci-add-test-upload
Nov 17, 2025
Merged

ci: add test result upload#1380
fslongjin merged 1 commit intomasterfrom
ci-add-test-upload

Conversation

@fslongjin
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings November 17, 2025 13:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds CI test result upload functionality to automatically parse and upload test results from syscall tests to a dashboard API.

  • Adds Python scripts to parse Google Test, Go Test, and pytest log formats and upload results to a CI dashboard
  • Implements a disk save mode in the Makefile to clean build cache before creating disk images
  • Simplifies the gvisor syscall test whitelist to only include read_test

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
user/apps/tests/syscall/gvisor/whitelist.txt Simplified whitelist to contain only read_test, removing all other tests and comments
user/Makefile Updated minimum DADK version requirement from 0.5.0 to 0.5.1
tools/test-upload/test_parse_and_upload.py Added comprehensive unit tests for the test log parsing functionality
tools/test-upload/requirements.txt Added Python dependency specification for requests library
tools/test-upload/parse_and_upload.py Implemented multi-format test log parser and API upload functionality
Makefile Added DISK_SAVE_MODE environment variable support to clean user program cache before disk image creation
.github/workflows/test-x86.yml Added CI workflow step to parse and upload test results, enabled disk save mode, and made test step continue on error

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self.assertIn('Expected: is equal to 4', error_log)
self.assertIn('Actual: 8', error_log)

def test_futx_example(self):
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in function name: "test_futx_example" should be "test_futex_example" (missing 'e').

Suggested change
def test_futx_example(self):
def test_futex_example(self):

Copilot uses AI. Check for mistakes.

# 检查API_KEY是否存在
if [ -z "$API_KEY" ]; then
echo "警告: TEST_UPLOAD_API_KEY secret未设置,跳过上传"
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message references 'TEST_UPLOAD_API_KEY' but the environment variable being checked is 'API_KEY' (from line 40). The error message should say "CI_DASHBOARD_UPLOAD_API_KEY secret未设置" to match the actual secret name.

Suggested change
echo "警告: TEST_UPLOAD_API_KEY secret未设置,跳过上传"
echo "警告: CI_DASHBOARD_UPLOAD_API_KEY secret未设置,跳过上传"

Copilot uses AI. Check for mistakes.
try:
error_data = e.response.json()
error_msg = error_data.get('message', str(e))
except:
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause is used here, which catches all exceptions including system exceptions like KeyboardInterrupt and SystemExit. Consider catching specific exceptions (e.g., except (ValueError, json.JSONDecodeError):) to avoid masking unexpected errors.

Suggested change
except:
except (ValueError, json.JSONDecodeError):

Copilot uses AI. Check for mistakes.
Comment on lines +328 to +331
test_error_pattern = re.compile(
r'(test/[^\n:]+:\d+:[^\n]*(?:\n(?!\[)[^\n]*)*)',
re.MULTILINE
)
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern r'(test/[^\n:]+:\d+:[^\n]*(?:\n(?!\[)[^\n]*)*)' is compiled twice in this class (lines 293-296 and lines 328-331). Consider extracting this as a class constant or compiling it once at the beginning of the method to improve performance and maintainability.

Copilot uses AI. Check for mistakes.
import argparse
import json
import requests
from typing import List, Dict, Optional
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Optional' is not used.

Suggested change
from typing import List, Dict, Optional
from typing import List, Dict

Copilot uses AI. Check for mistakes.
if duration:
try:
duration_ms = int(float(duration) * 1000)
except ValueError:
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except ValueError:
except ValueError:
# If duration cannot be parsed, leave duration_ms as 0

Copilot uses AI. Check for mistakes.
- 新增测试结果解析和上传工具,支持多种测试框架格式
- 在CI工作流中添加测试结果上传步骤
- 引入磁盘节省模式,优化构建缓存管理
- 更新DADK版本要求至0.5.1

Signed-off-by: longjin <longjin@DragonOS.org>
@fslongjin fslongjin merged commit 0874383 into master Nov 17, 2025
11 of 12 checks passed
@fslongjin fslongjin deleted the ci-add-test-upload branch November 21, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants