-
Notifications
You must be signed in to change notification settings - Fork 141
add compatible field to configs #1812
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,9 @@ | |||||||
| module Udb | ||||||||
| # resolves the specification in the context of a config, and writes to a generation folder | ||||||||
| # | ||||||||
| # Raised by Resolver#cfg_info when a config name or path cannot be found. | ||||||||
| class ConfigNotFoundError < StandardError; end | ||||||||
|
Comment on lines
17
to
+19
|
||||||||
| # | |
| # Raised by Resolver#cfg_info when a config name or path cannot be found. | |
| class ConfigNotFoundError < StandardError; end |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -555,4 +555,206 @@ def test_partial_config_parameter_defined_by_unknown_terms | |||||||||||
| assert param_reasons.first.include?("{unknown}"), "Expected {unknown} annotations for possible-but-not-mandatory extensions" | ||||||||||||
| end | ||||||||||||
| end | ||||||||||||
|
|
||||||||||||
| def test_compatible | ||||||||||||
| base_64_yaml = <<~YAML | ||||||||||||
| $schema: config_schema.json# | ||||||||||||
| kind: architecture configuration | ||||||||||||
| type: partially configured | ||||||||||||
| name: compat_test_base_64 | ||||||||||||
| description: Base 64-bit config for compatibility tests | ||||||||||||
| params: | ||||||||||||
| MXLEN: 64 | ||||||||||||
| mandatory_extensions: | ||||||||||||
| - name: "I" | ||||||||||||
| version: ">= 0" | ||||||||||||
| - name: "Sm" | ||||||||||||
| version: ">= 0" | ||||||||||||
| YAML | ||||||||||||
|
|
||||||||||||
| compat_64_yaml = <<~YAML | ||||||||||||
| $schema: config_schema.json# | ||||||||||||
| kind: architecture configuration | ||||||||||||
| type: partially configured | ||||||||||||
| name: compat_test_compat_64 | ||||||||||||
| description: Compatible 64-bit config | ||||||||||||
| params: | ||||||||||||
| MXLEN: 64 | ||||||||||||
| mandatory_extensions: | ||||||||||||
| - name: "I" | ||||||||||||
| version: ">= 0" | ||||||||||||
| - name: "Sm" | ||||||||||||
| version: ">= 0" | ||||||||||||
| - name: "M" | ||||||||||||
| version: ">= 0" | ||||||||||||
| YAML | ||||||||||||
|
|
||||||||||||
| incompat_32_yaml = <<~YAML | ||||||||||||
| $schema: config_schema.json# | ||||||||||||
| kind: architecture configuration | ||||||||||||
| type: partially configured | ||||||||||||
| name: compat_test_incompat_32 | ||||||||||||
| description: Incompatible 32-bit config (MXLEN conflict) | ||||||||||||
| params: | ||||||||||||
| MXLEN: 32 | ||||||||||||
| mandatory_extensions: | ||||||||||||
| - name: "I" | ||||||||||||
| version: ">= 0" | ||||||||||||
| - name: "Sm" | ||||||||||||
| version: ">= 0" | ||||||||||||
| YAML | ||||||||||||
|
|
||||||||||||
| also_compat_64_yaml = <<~YAML | ||||||||||||
| $schema: config_schema.json# | ||||||||||||
| kind: architecture configuration | ||||||||||||
| type: partially configured | ||||||||||||
| name: compat_test_also_compat_64 | ||||||||||||
| description: Another compatible 64-bit config | ||||||||||||
| params: | ||||||||||||
| MXLEN: 64 | ||||||||||||
| mandatory_extensions: | ||||||||||||
| - name: "I" | ||||||||||||
| version: ">= 0" | ||||||||||||
| - name: "Sm" | ||||||||||||
| version: ">= 0" | ||||||||||||
| YAML | ||||||||||||
|
|
||||||||||||
| Tempfile.create(%w/compat_64 .yaml/) do |compat_64_file| | ||||||||||||
| compat_64_file.write(compat_64_yaml) | ||||||||||||
| compat_64_file.flush | ||||||||||||
|
|
||||||||||||
| Tempfile.create(%w/incompat_32 .yaml/) do |incompat_32_file| | ||||||||||||
| incompat_32_file.write(incompat_32_yaml) | ||||||||||||
| incompat_32_file.flush | ||||||||||||
|
|
||||||||||||
| Tempfile.create(%w/also_compat_64 .yaml/) do |also_compat_64_file| | ||||||||||||
| also_compat_64_file.write(also_compat_64_yaml) | ||||||||||||
| also_compat_64_file.flush | ||||||||||||
|
|
||||||||||||
| # 1. Valid single compatible pointer | ||||||||||||
| Tempfile.create(%w/cfg .yaml/) do |f| | ||||||||||||
| f.write(base_64_yaml.sub("mandatory_extensions:", "compatible: #{compat_64_file.path}\nmandatory_extensions:")) | ||||||||||||
| f.flush | ||||||||||||
| result = @resolver.cfg_arch_for(Pathname.new(f.path)).valid? | ||||||||||||
| assert result.valid, "Expected valid for compatible with matching MXLEN, got: #{result.reasons}" | ||||||||||||
| end | ||||||||||||
|
|
||||||||||||
| # Name-based pointer: use a known repo config name (no '/' → name lookup branch) | ||||||||||||
| Tempfile.create(%w/cfg .yaml/) do |f| | ||||||||||||
| f.write(base_64_yaml.sub("mandatory_extensions:", "compatible: rv64\nmandatory_extensions:")) | ||||||||||||
| f.flush | ||||||||||||
| result = @resolver.cfg_arch_for(Pathname.new(f.path)).valid? | ||||||||||||
| # rv64 is a known repo config; compatibility check should not raise | ||||||||||||
| assert [true, false].include?(result.valid), | ||||||||||||
| "Expected cfg_arch_for_pointer to resolve name-based pointer 'rv64' without error" | ||||||||||||
|
Comment on lines
+647
to
+649
|
||||||||||||
| # rv64 is a known repo config; compatibility check should not raise | |
| assert [true, false].include?(result.valid), | |
| "Expected cfg_arch_for_pointer to resolve name-based pointer 'rv64' without error" | |
| assert result.valid, | |
| "Expected valid when compatible pointer is the known config name 'rv64', got: #{result.reasons}" |
Uh oh!
There was an error while loading. Please reload this page.