Throw error if `debug.yaml` not found #153

Merged
merged 3 commits into from Feb 29, 2016

Conversation

Projects
None yet
4 participants
@aciidb0mb3r
Member

aciidb0mb3r commented Feb 27, 2016

Shows error this error if swift test is run before swift build

error: build the package using `swift build` before running tests

instead of

<unknown>:0: error: unable to attach DB: unable to open database
error: exit(1): swift-build-tool -f /Users/aciid/mycode/test/MyPackage/.build/debug.yaml test
@czechboy0

This comment has been minimized.

Show comment
Hide comment
@czechboy0

czechboy0 Feb 27, 2016

Contributor

Is there a reason to not automatically run swift build as the first step of swift test? To me running build, then test, then changing some test code and running test again - I'd assume that the changes would be applied. But since testing doesn't rebuild it doesn't, which initially confused me and I wonder whether it's not going to be confusing to newcomers as well.

I'd probably propose to automatically run build as the first step of test. Or is there a reason not to?

Contributor

czechboy0 commented Feb 27, 2016

Is there a reason to not automatically run swift build as the first step of swift test? To me running build, then test, then changing some test code and running test again - I'd assume that the changes would be applied. But since testing doesn't rebuild it doesn't, which initially confused me and I wonder whether it's not going to be confusing to newcomers as well.

I'd probably propose to automatically run build as the first step of test. Or is there a reason not to?

@aciidb0mb3r

This comment has been minimized.

Show comment
Hide comment
@aciidb0mb3r

aciidb0mb3r Feb 27, 2016

Member

agreed, Utilities/bootstrap test also builds if not already built instead of exiting with error.
@mxcl suggestions?

Member

aciidb0mb3r commented Feb 27, 2016

agreed, Utilities/bootstrap test also builds if not already built instead of exiting with error.
@mxcl suggestions?

@mxcl

This comment has been minimized.

Show comment
Hide comment
@mxcl

mxcl Feb 27, 2016

Contributor

@czechboy0 we may change it. As it stands things are more flexible if you can control when the build happens entirely.

Contributor

mxcl commented Feb 27, 2016

@czechboy0 we may change it. As it stands things are more flexible if you can control when the build happens entirely.

Sources/swift-test/main.swift
@@ -24,6 +24,8 @@ do {
setenv("SPM_INSTALL_PATH", dir.build, 0)
let yamlPath = Path.join(dir.build, "debug.yaml")
+ if !yamlPath.exists { throw Error.DebugYAMLNotFound }

This comment has been minimized.

@mxcl

mxcl Feb 27, 2016

Contributor

guard seems more appropriate to me.

@mxcl

mxcl Feb 27, 2016

Contributor

guard seems more appropriate to me.

This comment has been minimized.

@aciidb0mb3r

aciidb0mb3r Feb 27, 2016

Member

Fixed

+ return "build the package using `swift build` before running tests"
+ }
+ }
+}

This comment has been minimized.

@keith

keith Feb 27, 2016

Contributor

Looks like there's no newline at the end of this file.

@keith

keith Feb 27, 2016

Contributor

Looks like there's no newline at the end of this file.

This comment has been minimized.

@aciidb0mb3r

aciidb0mb3r Feb 27, 2016

Member

fixed

@czechboy0

This comment has been minimized.

Show comment
Hide comment
@czechboy0

czechboy0 Feb 27, 2016

Contributor

@mxcl Makes sense. The way I think of it is in Xcode, the "easier" action is Run and Test, which actually mean Build+Run and Build+Test. Then you can trigger Run Without Building & Test Without Building manually, but that's more work.
In the same way I'd imagine we'd change the default here to build before testing, but we'd also add a flag to just test, something like swift build --test --no-rebuild or similar.

Contributor

czechboy0 commented Feb 27, 2016

@mxcl Makes sense. The way I think of it is in Xcode, the "easier" action is Run and Test, which actually mean Build+Run and Build+Test. Then you can trigger Run Without Building & Test Without Building manually, but that's more work.
In the same way I'd imagine we'd change the default here to build before testing, but we'd also add a flag to just test, something like swift build --test --no-rebuild or similar.

mxcl added a commit that referenced this pull request Feb 29, 2016

Merge pull request #153 from aciidb0mb3r/tests_yaml_check
Throw error if `debug.yaml` not found

@mxcl mxcl merged commit 8f1a3ee into apple:master Feb 29, 2016

@aciidb0mb3r aciidb0mb3r deleted the aciidb0mb3r:tests_yaml_check branch Feb 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment