-
Notifications
You must be signed in to change notification settings - Fork 38
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
Convert schema into JSON #198
Conversation
Can one of the admins verify this patch? |
For old thread, see #180 |
@Dineshraghuwanshi please verify if the json file includes equivalent changes for #164 |
Can also check if auto_schema.c shows the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any change in the JSON file will get reflected in the schema.c file , however the reverse is not true.
For users/developers who prefer to modify .c file directly i see that $ python3 sdtester.py -g -c ../../ec/platform/oc-sdr/schema/schema.c -j ../../ec/platform/oc-sdr/schema/sys_schema.json this command will generate the JSON file . Is there any plan to document this ? .
This is a major change could we test on the actual target and confirm that nothing is broken from host and firmware perspective.
This looks good to me . . . . |
Eventually the .c will be removed from the repo, so users shouldn't modify the .c directly after this change. Before it can be removed, CCS project has to be modified to run the generation script before compile, which will be done in a subsequent PR.
Agree, this should be verified on the hardware. In theory the binary files shouldn't really change at all, curious the result of running |
The schema c-file is going away and at this point it no longer needs to be in the repo. It was left in for 2 reasons: First, some people use CCS and the build process isn't set up to run Python from within CCS. Issue #203 was submitted to resolve this. The second reason is that having the schema c-file in this branch makes the code review easier. The purpose of this change is that, going forward, users will modify the schema directly in the JSON configuration file. Once issue 203 is resolved, the schema c-file will be removed, as well as the sdtester code that converts a c-file into JSON. |
Any more changes? We're targeting a merge this week. |
Do we have any plan to test on the target platform ? |
Added step 11 to test plan to confirm that we can handle arbitrary json configurations. |
Yes, we should |
Please add the test logs once they are done , i will review those and approve this PR . |
We don't have a complete test setup, so most tests will fail regardless. Is your team able to test? |
We are in the middle of the testing alerts, i doubt if we will be able to test immediately . |
Vishal can test for us at MPK and approve when it passes. Thanks. |
RF Tested and verified OK. Attached are few screenshots for attenuation and PA controls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Thanks to all for the effort reviewing, feedback, and help testing. This one was a major change. |
Summary
Rebasing json schema with TIP master. Successor of jspectacular:json_schema branch, which was closed due to merge conflicts.
Dependencies
Install jsonschema, viz.:
Test Plan
Verify the builds
Note: old schema.c file should not be in schema folder and has been removed from repo. It will cause build failure. auto_schema.c included in repo for those still using Code Composer, but file will be generated from json schema declaration.
With fresh checkout, build from firmware/ec. Verify build with no new errors or warnings vs master; verify that output dialog says:
Build from firmware/host. Verify build; verify that output dialog says:
Touch sys_schema.json, build from either host or ec. Verify that output dialog says
Delete valid_schema.json, build from either host or ec. Verify that output dialog says
Delete sys_schema.json, build from either host or ec. Verify that build fails and output dialog says
Verify the structured data tester and generator
Note: cd to firmware/utilities/schema.
Note: Draft 6 validator only available with jsonschema 3.0; use draft 4 for now
Objective: Demonstrate how json configuration file can be created from schema c-file
Delete auto_schema.c and sys_schema.json; copy old schema.c into folder. Generate new JSON schema file (ex4 in sdtester.py), from shell:
python3 sdtester.py -g
; verify that sys_schema.json is createdObjective: Demonstrate how schema c-file is generated from json configuration file
From shell, repeat ex1 in sdtester.py. Verify that auto_schema.c is created
Objective: Demonstrate that sdtester fails when json configuration file is missing.
From shell, delete sys_schema.json and attempt to repeat step 7; verify system exit
Objective: Demonstrate that sdtester throws validation error when meta schema is bad.
Uncomment line 107 (only) in schemautils.py and repeat test 7; verify that output dialog states
Uncomment line 108 (only) in schemautils.py and repeat test 7; verify that output dialog states
Modify sys_schema.json as desired, run example 5 in sdtester.py with d0 as the validation file. Verify that the c-file is created.
Issues
Closes issue #173
Closes issue #180