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

tools.vpm: update tests, add get_installed test #20028

Merged
merged 5 commits into from Nov 29, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Nov 28, 2023

Updates vpm tests that have increased in number, makes some minor improvements, adds a test.

Changes split into commits.

🤖[deprecated] Generated by Copilot at b40475b

The pull request enhances the vpm tool and its tests by refactoring code, improving error handling, increasing reliability, and adding more test cases and logging. It affects the files dependency_test.v, install_test.v, install_version_input_test.v, install_version_test.v, update_test.v, and parse.v in the cmd/tools/vpm directory.

🤖[deprecated] Generated by Copilot at b40475b

  • Increase the retry count for vtest from 3 to 5 in dependency_test.v, install_version_test.v, and update_test.v to reduce flaky test failures (link, link, link)
  • Replace os.execute_or_exit with os.execute and add assert statements to check the exit code and the output of the commands in various test cases in dependency_test.v, install_test.v, and update_test.v to improve error handling and test assertions (link, link, link, link, link, link)
  • Introduce a helper function get_vmod to parse the v.mod file and return a vmod.Manifest struct in install_test.v, and update the test cases in install_test.v, install_version_input_test.v, and install_version_test.v to use this function and access the manifest fields instead of separate variables (link, link, link, link, link, link, link, link, link, link)
  • Add a new test case to test the get_installed method of the Module struct in install_test.v, which checks the installation and version status of a module with different branch and tag states (link)
  • Add a logging statement to print the refs output of the git ls-remote command in parse.v, for debugging purposes (link)
  • Add a comment to clarify that the last test case in install_version_test.v installs from a GitLab repository, not GitHub (link)
  • Change the file name and the module name from install_test.v to dependency_test.v in install_test.v, to reflect the broader scope of the tests (link)

@ttytm ttytm marked this pull request as draft November 28, 2023 21:13
@ttytm
Copy link
Member Author

ttytm commented Nov 29, 2023

The occasional failure with windows msvc seems to be unrelated.

  • Failed Run:
    https://github.com/vlang/v/actions/runs/7025981543/job/19117867731?pr=20028

  • Error:

    D:\a\v\v\thirdparty\mbedtls\library\debug.c : fatal error C1083: Cannot open compiler generated file: 'D:\a\v\v\thirdparty\mbedtls\library\debug.obj': Permission denied
    
  • Plain text link to an issue of another project that also encounters this problem with windows msvc.

    github.com/compiler-explorer/compiler-explorer/issues/4953
    

@ttytm ttytm marked this pull request as ready for review November 29, 2023 11:47
@@ -20,62 +20,62 @@ fn testsuite_end() {
os.rmdir_all(test_path) or {}
}

fn get_vmod(path string) vmod.Manifest {
return vmod.from_file(os.join_path(test_path, path, 'v.mod')) or {
eprintln('Failed to parse v.mod for `${path}`')
Copy link
Member

Choose a reason for hiding this comment

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

please add err: $err in the message too

os.chdir(test_project_path)!
os.write_file('v.mod', '')!
if os.getenv('CI') != '' {
os.execute_or_exit('git config --global user.email "v@vi.com"')
Copy link
Member

Choose a reason for hiding this comment

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

vi.com ?

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit 74c59ab into vlang:master Nov 29, 2023
41 of 42 checks passed
@ttytm ttytm deleted the tools/vpm/update-tests branch December 15, 2023 22:07
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.

None yet

2 participants