-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
atlas: tests graph generation (#21990)
* atlas: tests graph generation * silly typo * make tests green; lockfile implementation begins to make sense * make tests green on Windows
- Loading branch information
Showing
8 changed files
with
144 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Small program that runs the test cases | ||
|
||
import std / [strutils, os, sequtils] | ||
from std/private/gitutils import diffFiles | ||
|
||
var failures = 0 | ||
|
||
when defined(develop): | ||
const atlasExe = "bin" / "atlas".addFileExt(ExeExt) | ||
if execShellCmd("nim c -o:$# atlas/atlas.nim" % [atlasExe]) != 0: | ||
quit("FAILURE: compilation of atlas failed") | ||
else: | ||
const atlasExe = "atlas".addFileExt(ExeExt) | ||
|
||
proc exec(cmd: string) = | ||
if execShellCmd(cmd) != 0: | ||
quit "FAILURE: " & cmd | ||
|
||
proc sameDirContents(expected, given: string) = | ||
for _, e in walkDir(expected): | ||
let g = given / splitPath(e).tail | ||
if fileExists(g): | ||
if readFile(e) != readFile(g): | ||
echo "FAILURE: files differ: ", e | ||
echo diffFiles(e, g).output | ||
inc failures | ||
else: | ||
echo "FAILURE: file does not exist: ", g | ||
inc failures | ||
|
||
proc testWsConflict() = | ||
const myproject = "atlas/tests/ws_conflict/myproject" | ||
createDir(myproject) | ||
exec atlasExe & " --project=" & myproject & " --showGraph --genLock use https://github.com/apkg" | ||
sameDirContents("atlas/tests/ws_conflict/expected", myproject) | ||
removeDir("atlas/tests/ws_conflict/apkg") | ||
removeDir("atlas/tests/ws_conflict/bpkg") | ||
removeDir("atlas/tests/ws_conflict/cpkg") | ||
removeDir("atlas/tests/ws_conflict/dpkg") | ||
removeDir(myproject) | ||
|
||
testWsConflict() | ||
if failures > 0: quit($failures & " failures occurred.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"items": { | ||
"apkg": { | ||
"url": "file://./source/apkg", | ||
"commit": "<invalid commit>" | ||
}, | ||
"bpkg": { | ||
"url": "file://./source/bpkg", | ||
"commit": "1.0" | ||
}, | ||
"cpkg": { | ||
"url": "file://./source/cpkg", | ||
"commit": "2.0" | ||
}, | ||
"dpkg": { | ||
"url": "file://./source/dpkg", | ||
"commit": "1.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
digraph deps { | ||
"file://./source/apkg/<invalid commit>" [label=""]; | ||
"file://./source/bpkg/1.0" [label=""]; | ||
"file://./source/cpkg/1.0" [label="unused"]; | ||
"file://./source/cpkg/2.0" [label=""]; | ||
"file://./source/dpkg/1.0" [label=""]; | ||
"file://./source/apkg/<invalid commit>" -> "file://./source/bpkg/1.0"; | ||
"file://./source/apkg/<invalid commit>" -> "file://./source/cpkg/1.0"; | ||
"file://./source/bpkg/1.0" -> "file://./source/cpkg/2.0"; | ||
"file://./source/cpkg/2.0" -> "file://./source/dpkg/1.0"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requires "https://github.com/apkg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
############# begin Atlas config section ########## | ||
--noNimblePath | ||
--path:"../apkg" | ||
--path:"../bpkg" | ||
--path:"../cpkg" | ||
--path:"../dpkg" | ||
############# end Atlas config section ########## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# empty for now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters