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

Extract and genericize Graph for easier testing #6010

Merged
merged 6 commits into from
Jun 26, 2018

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Jun 23, 2018

Problem

#4558 involves some relatively fidgety logic, but Graph was built in-situ and does not have any tests of its own.

Solution

Extract and genericize Graph to allow for adding unit tests of the new behaviour in #4558. Add a very basic test; more useful ones will follow.

@stuhood stuhood force-pushed the stuhood/extract-graph branch from b1b4a88 to 775e8cb Compare June 23, 2018 03:59
@stuhood stuhood force-pushed the stuhood/extract-graph branch from 868cb58 to 9358577 Compare June 24, 2018 02:01
@stuhood stuhood requested review from cosmicexplorer and removed request for jsirois June 24, 2018 03:22
fn format(&self) -> String;

///
/// If this Node represents an FS operation, returns its input Path.
Copy link
Contributor

Choose a reason for hiding this comment

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

What kind of path? Absolute? Relative to build root?

Copy link
Member Author

Choose a reason for hiding this comment

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

You trolled me into making this more generic.

///
pub trait NodeTracer<N: Node> {
///
/// Returns true if the given Node Result represents the "bottom" of a trace.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does bottom mean? A leaf node? The most recently executed stack frame? The opposite of one of the above?

fn create(&self, entry_id: EntryId) -> Context {
Context::new(entry_id, self.clone())
#[derive(Clone)]
struct RootContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

What value is this providing over just using an Arc<Core>?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because the NodeContext trait comes from our new graph crate and we don't own Arc?

Copy link
Member Author

@stuhood stuhood Jun 25, 2018

Choose a reason for hiding this comment

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

@jsirois : Bingo. Coherence.

Will add a comment.

fn create(&self, entry_id: EntryId) -> Context {
Context::new(entry_id, self.clone())
#[derive(Clone)]
struct RootContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because the NodeContext trait comes from our new graph crate and we don't own Arc?

@stuhood stuhood merged commit 48224fc into pantsbuild:master Jun 26, 2018
@stuhood stuhood deleted the stuhood/extract-graph branch June 26, 2018 01:19
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.

3 participants