CSC/ECE 517 Spring 2017/M1701: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
== Project Description == | == Project Description == | ||
The repository www.github.com/servo/rust-har[http://www.github.com/servo/rust-har] is a library which implements HAR 1.2 spec in Rust. It was last changed two years ago and our task involved making it adhere to the syntax of the latest version of rust. | The repository www.github.com/servo/rust-har[http://www.github.com/servo/rust-har] is a library which implements HAR 1.2 spec in Rust. It was last changed two years ago and our task involved making it adhere to the syntax of the latest version of rust. The original code made use of some outdated code and syntax patterns. Our purpose was to make some key changes to those aspects of the code, that make it look better and such that it becomes more DRY. | ||
The primary purpose of our contribution to the project was to add native support for the feature that enables the creation of HTTP archive files which can be analyzed by other tools. The addition of this feature to Servo allows more precise comparisons to be made with other browsers. | The primary purpose of our contribution to the project was to add native support for the feature that enables the creation of HTTP archive files which can be analyzed by other tools. The addition of this feature to Servo allows more precise comparisons to be made with other browsers. | ||
Line 51: | Line 51: | ||
[[File:Screen1 5.png|center|writing test cases to use the new constructors]] | [[File:Screen1 5.png|center|writing test cases to use the new constructors]] | ||
== Testing == | |||
In terms of testing, we took care of the following: | |||
1. We modified all test cases to implement "new constructor for structs" | |||
2. Added a new test case 'test_page_timings_float' to verify that when a float value is passed for 'OptionalTiming'. We are asserting that deserializer returns an error. | |||
3. When all syntax were modified to the latest version, only a few tests were failing due to camelCase issues. Those were fixed. | |||
4. Earlier, we were asserting by comparing string. Now we see if two objects match. | |||
== References == | == References == | ||
<references/> | <references/> |
Latest revision as of 02:15, 1 April 2017
Introduction
Servo
Servo<ref>https://en.wikipedia.org/wiki/Servo_(layout_engine)</ref> is a research project with the aim of creating a web browser layout engine written in Rust, being developed by Mozilla Research. The prototype of the system currently seeks to create a highly parallel environment in which many components are handled by fine-grained, isolated components. Servo provides a consistent API for hosting the engine within other software.Servo is still at an early stage of development. Servo can act as a standalone browser.
Rust
Rust<ref> https://en.wikipedia.org/wiki/Rust_(programming_language)</ref> is a general purpose, multi-paradigm, programming language sponsored, developed, and maintained by Mozilla Research for creating highly concurrent and highly safe systems. The development of Rust had an emphasis on control of memory layout, safety, and concurrency. It is very similar to C++ in terms of syntax but differs heavily in its semantics.
Project Description
The repository www.github.com/servo/rust-har[1] is a library which implements HAR 1.2 spec in Rust. It was last changed two years ago and our task involved making it adhere to the syntax of the latest version of rust. The original code made use of some outdated code and syntax patterns. Our purpose was to make some key changes to those aspects of the code, that make it look better and such that it becomes more DRY.
The primary purpose of our contribution to the project was to add native support for the feature that enables the creation of HTTP archive files which can be analyzed by other tools. The addition of this feature to Servo allows more precise comparisons to be made with other browsers. Our primary steps while working on the project involved<ref>https://github.com/servo/servo/wiki/HTTP-archive-support-project</ref>:
clone the rust-har repository and update the code to build with a modern version of Rust:
- remove/replace invalid integer suffixes
- replace box expressions with Box::new syntax
- replace use of serialize crate with serde_json
- add a new constructor for the Timing/CacheEntry/Cache/Content/Entry/Request/Response/Cookie/Header structures
- make the tests use the new constructor methods (cargo test)
- add TravisCI integration
Design Pattern
No design pattern was needed/used in this project.
Implementation
We have completed the above steps, and following are some of the snippets of code that were added or altered. Here is the pull request for this project.
Step 1: removing/replacing invalid integer suffixes
Step 2: replacing box expressions with Box::new syntax
Step 3: replacing use of serialize crate with serde_json
Step 4: adding new constructors for the structures
Step 5: writing test cases to use the new constructors
Testing
In terms of testing, we took care of the following:
1. We modified all test cases to implement "new constructor for structs"
2. Added a new test case 'test_page_timings_float' to verify that when a float value is passed for 'OptionalTiming'. We are asserting that deserializer returns an error.
3. When all syntax were modified to the latest version, only a few tests were failing due to camelCase issues. Those were fixed.
4. Earlier, we were asserting by comparing string. Now we see if two objects match.
References
<references/>