Skip to content

Conversation

@RenatoGeh
Copy link
Contributor

This patch adds the required test dependencies to fix the following error.

1/14 IO/CircuitSaverTest.jl
: Error During Test at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/IO/CircuitSaverTest.jl:2
  Got exception outside of a @test
  LoadError: ArgumentError: Package LogicCircuits not found in current path:
  - Run `import Pkg; Pkg.add("LogicCircuits")` to install the LogicCircuits package.

  Stacktrace:
   [1] macro expansion at /home/renatogeh/.julia/packages/Jive/jhUhw/src/runtests.jl:410 [inlined]
   [2] macro expansion at ./util.jl:234 [inlined]
   [3] run(::String, ::Array{String,1}, ::Int64) at /home/renatogeh/.julia/packages/Jive/jhUhw/src/runtests.jl:232
   [4] runtests(::String; skip::Array{String,1}, node1::Array{Any,1}, targets::Array{String,1}, enable_distributed::Bool) at /home/renatogeh/.julia/packages/Jive/jhUhw/src/runtests.jl:79
   [5] top-level scope at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/runtests.jl:14
   [6] top-level scope at none:6
  in expression starting at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/IO/CircuitSaverTest.jl:2

    Error 1
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/runtests.jl:14
ERROR: Package ProbabilisticCircuits errored during testing
Stacktrace:
 [1] pkgerror(::String, ::Vararg{String,N} where N) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:53
 [2] test(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:1503
 [3] test(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; coverage::Bool, test_fn::Nothing, julia_args::Cmd, test_args::Cmd, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /build/julia/src/julia-1.4
.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:316
 [4] test(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:303
 [5] #test#68 at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:297 [inlined]
 [6] test at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:297 [inlined]
 [7] #test#67 at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:296 [inlined]
 [8] test at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:296 [inlined]
 [9] test(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:295
 [10] test(::String) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:295
 [11] top-level scope at REPL[4]:1

The above error happens even when LogicCircuits is already installed. I don't know anything about Julia yet, so I might be doing something wrong. But this patch seemed to fix it.

@RenatoGeh
Copy link
Contributor Author

Oops. It seems I duplicated a dependency in Project.toml. Fixed and force pushed.

@khosravipasha
Copy link
Contributor

Thanks for the pull request. Yeah, it seems our readme for how to run the tests is a bit outdated, and there is small issues with test environment. What command did you run and how did you install the ProbabilisticCircuit package (from master or v0.1?)

I think adding LogicCircuits under test/Project.toml would cause issues, because then we get two versions of LogicCircuits, one if the test environment and one from ProbabilisticCircuits. I will check it out and see what's the best option to fix this.

In the meanwhile, the following workflow works for me to run the tests:

  1. Install ProbabilisticCircuits from master (also note that LogicCircuits is also installed from master branch)

    julia -e 'using Pkg; Pkg.add([PackageSpec(url="https://github.com/Juice-jl/LogicCircuits.jl.git"),PackageSpec(url="https://github.com/Juice-jl/ProbabilisticCircuits.jl.git")])'
    
  2. Run the tests. This way it automatically instantiates the test environment and runs the tests.

    julia --project=./test test/runtests.jl
    

@RenatoGeh
Copy link
Contributor Author

I did exactly as the README says. First I installed LogicCircuits:

julia -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/Juice-jl/LogicCircuits.jl.git"))'

Ran tests. All good.

julia --color=yes -e 'using Pkg; Pkg.test("LogicCircuits")'

Then ProbabilisticCircuits:

julia -e 'using Pkg; Pkg.add([PackageSpec(url="https://github.com/Juice-jl/LogicCircuits.jl.git"),PackageSpec(url="https://github.com/Juice-jl/ProbabilisticCircuits.jl.git")])'

Then ran tests as stated in the README:

julia --color=yes -e 'using Pkg; Pkg.test("LogicCircuits")'

And got the error mentioned in my original PR description.


Unfortunately, this line

julia --project=./test test/runtests.jl

Outputs the following error:

ERROR: LoadError: TaskFailedException:
SystemError: opening file "/home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/Project.toml": Permission denied
Stacktrace:
 [1] up(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; level::Pkg.Types.UpgradeLevel, mode::Pkg.Types.PackageMode, update_registry::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:224
 [2] #up#43 at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:192 [inlined]
 [3] instantiate(::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Pkg.BinaryPlatforms.Linux, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:763
 [4] instantiate(::Pkg.Types.Context) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:748
 [5] #instantiate#116 at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:744 [inlined]
 [6] instantiate() at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:744
 [7] top-level scope at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/runtests.jl:6
 [8] eval at ./boot.jl:331 [inlined]
 [9] (::Distributed.var"#153#154"{Module,Expr})() at ./task.jl:358
Stacktrace:
 [1] macro expansion at ./task.jl:335 [inlined]
 [2] remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Distributed/src/macros.jl:217
 [3] top-level scope at /build/julia/src/julia-1.4.1/usr/share/julia/stdlib/v1.4/Distributed/src/macros.jl:201
 [4] top-level scope at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/runtests.jl:9
in expression starting at /home/renatogeh/.julia/packages/ProbabilisticCircuits/NTXbs/test/runtests.jl:6

I'm guessing (again, I don't know anything about Julia, so I might be talking out of my ass) you're running this command in your local git repository, and so it is readable. I suppose Julia makes packages read-only for Pkg-added sources (which makes sense).

@RenatoGeh
Copy link
Contributor Author

By the way, (naturally) the same happens when trying to generate the docs.

P.S.: There's a small typo in both ProbabilisticCircuits and LogicalCircuits for the line on generating docs. There's a closing ' missing. ;)

@khosravipasha khosravipasha self-assigned this May 13, 2020
@khosravipasha
Copy link
Contributor

Aha, yes I was running this command in my folder which cloned the ProbabilisticCircuits. Some of the readme commands also make this assumption, I should note that in the readme.

But, yeah we would like to be able run the tests the way you did as well (i.e. without cloning the repos), so adding LogicCircuits to the test\Project.toml makes sense. We don't want to add everything to test\Project.toml though since julia does it automatically. I think during testing julia makes a temporary environment and using both test\Project.toml and Project.toml. Also it uses the Manifest.toml files to decide which version/commit of the packages to grab.

It seems we only need to add LogicCircuits and Random to the test/Project.toml to make things work. I will edit the pull request to see if that works. Probably would need to update my travis commands too.

@khosravipasha
Copy link
Contributor

Thanks for catch. Merging now, as the test are now passing. Also I will go through the readmes and update them.

I tried locally outside the the ProbabilisticCircuits folder and your workflow seems to work now. Please, let us know if you run into anymore issues.

@khosravipasha khosravipasha merged commit 79a7c38 into Tractables:master May 13, 2020
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.

2 participants