Skip to content

Commit

Permalink
test: add sources directory cleaning test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou authored and kit-ty-kate committed Jul 24, 2024
1 parent 1c85401 commit 93d11e9
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 0 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ users)
* Add a test in admin cache for hash cache [#6103 @rjbou]
* Add admin cache test [#6068 @rjbou]
* env: Add a test for `build-env` overwrites build env opam environment variables [#5377 @rjbou]
* clean: Add to check cleaning of sources directories [#5474 @rjbou]

### Engine

Expand Down
187 changes: 187 additions & 0 deletions tests/reftests/clean.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
N0REP0
### : untracked option :
### <pkg:things.1>
opam-version: "2.0"
build : [ "touch" "first" "second" ]
Expand Down Expand Up @@ -108,3 +109,189 @@ Remaining files:
- ${BASEDIR}/OPAM/clean/bin/first

Remove them? [y/n] y
### : Clean of sources directory :
### <waste/file>
yes, i'm a file
### <pin:waste/waste.opam>
opam-version: "2.0"
### tar czf waste.tgz waste/file
### <pkg:waste.1>
opam-version: "2.0"
### <mkurl.sh>
n=waste
v=1
arch=waste.tgz
file="REPO/packages/$n/$n.$v/opam"
echo "url {" >> "$file"
echo "src: \"$arch\"" >> "$file"
MD5=$(openssl md5 "$arch" | cut -d' ' -f2)
echo "checksum: \"md5=$MD5\"" >> "$file"
echo "}" >> "$file"
basedir=`echo "$BASEDIR" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g"`
echo "dev-repo: \"file://${basedir}/$n\"" >> "$file"
### sh mkurl.sh
### <pkg:waste-local.1>
opam-version: "2.0"
### <mkurl.sh>
n=waste-local
v=1
file="REPO/packages/$n/$n.$v/opam"
basedir=`echo "$BASEDIR" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g"`
echo "url { local: \"file://${basedir}/waste\" }" >> "$file"
### sh mkurl.sh
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### : at install
### opam install waste
The following actions will be performed:
=== install 1 package
- install waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (file://${BASEDIR}/waste.tgz)
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources/
waste.1
### : at removal
### opam remove waste
The following actions will be performed:
=== remove 1 package
- remove waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### : at reinstall
### opam install waste
The following actions will be performed:
=== install 1 package
- install waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (cached)
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
waste.1
### opam reinstall waste
The following actions will be performed:
=== recompile 1 package
- recompile waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (cached)
-> removed waste.1
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### : at atomic reinstall
### opam remove waste
The following actions will be performed:
=== remove 1 package
- remove waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### opam install ./waste
waste is now pinned to file://${BASEDIR}/waste (version 1)
The following actions will be performed:
=== install 1 package
- install waste 1 (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (file://${BASEDIR}/waste)
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
waste
### : at atomic repin with reinstall: --dev pin
### opam unpin waste
Ok, waste is no longer pinned to file://${BASEDIR}/waste (version 1)
The following actions will be performed:
=== recompile 1 package
- recompile waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (cached)
-> removed waste.1
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### opam remove waste
The following actions will be performed:
=== remove 1 package
- remove waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### opam pin waste --dev
[waste.1] synchronised (file://${BASEDIR}/waste)
waste is now pinned to file://${BASEDIR}/waste (version 1)

The following actions will be performed:
=== install 1 package
- install waste 1 (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (file://${BASEDIR}/waste)
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
waste
### : at atomic repin with reinstall: version pin
### opam unpin waste
Ok, waste is no longer pinned to file://${BASEDIR}/waste (version 1)
The following actions will be performed:
=== recompile 1 package
- recompile waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (cached)
-> removed waste.1
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### opam remove waste
The following actions will be performed:
=== remove 1 package
- remove waste 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
### opam pin waste 1
waste is now pinned to version 1

The following actions will be performed:
=== install 1 package
- install waste 1 (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste.1 (cached)
-> installed waste.1
Done.
### ls OPAM/clean/.opam-switch/sources
waste
### : at install, with an url not poiting to an archive
### opam install waste-local
The following actions will be performed:
=== install 1 package
- install waste-local 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved waste-local.1 (file://${BASEDIR}/waste)
-> installed waste-local.1
Done.
### ls OPAM/clean/.opam-switch/sources
waste
waste-local.1

0 comments on commit 93d11e9

Please sign in to comment.