Skip to content

Commit

Permalink
Add /tests dir (coral-xyz#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante authored Sep 4, 2021
1 parent ea292e3 commit 5d8b476
Show file tree
Hide file tree
Showing 191 changed files with 42 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ target/
test-ledger
examples/*/Cargo.lock
examples/**/Cargo.lock
tests/*/Cargo.lock
tests/**/Cargo.lock
.DS_Store
docs/yarn.lock
ts/docs/
Expand Down
10 changes: 5 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[submodule "examples/swap/deps/serum-dex"]
path = examples/swap/deps/serum-dex
path = tests/swap/deps/serum-dex
url = https://github.com/project-serum/serum-dex
[submodule "examples/cfo/deps/serum-dex"]
path = examples/cfo/deps/serum-dex
path = tests/cfo/deps/serum-dex
url = https://github.com/project-serum/serum-dex
[submodule "examples/cfo/deps/swap"]
path = examples/cfo/deps/swap
path = tests/cfo/deps/swap
url = https://github.com/project-serum/swap.git
[submodule "examples/cfo/deps/stake"]
path = examples/cfo/deps/stake
path = tests/cfo/deps/stake
url = https://github.com/project-serum/stake.git
[submodule "examples/permissioned-markets/deps/serum-dex"]
path = examples/permissioned-markets/deps/serum-dex
path = tests/permissioned-markets/deps/serum-dex
url = https://github.com/project-serum/serum-dex
52 changes: 26 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _defaults: &defaults
- nvm install $NODE_VERSION
- sudo apt-get install -y pkg-config build-essential libudev-dev

_examples: &examples
_tests: &tests
before_install:
- nvm install $NODE_VERSION
- npm install -g mocha
Expand Down Expand Up @@ -47,35 +47,35 @@ jobs:
- pushd ts && yarn && popd
- pushd ts && yarn test && popd
- pushd ts && yarn lint && popd
- <<: *examples
name: Runs the examples 1
- <<: *tests
name: Runs the e2e tests 1
script:
- pushd client/example && ./run-test.sh && popd
- pushd examples/sysvars && anchor test && popd
- pushd examples/composite && anchor test && popd
- pushd examples/errors && anchor test && popd
- pushd examples/spl/token-proxy && anchor test && popd
- pushd examples/multisig && anchor test && popd
- pushd examples/interface && anchor test && popd
- pushd examples/lockup && anchor test && popd
- pushd examples/permissioned-markets/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
- <<: *examples
name: Runs the examples 2
- pushd tests/sysvars && anchor test && popd
- pushd tests/composite && anchor test && popd
- pushd tests/errors && anchor test && popd
- pushd tests/spl/token-proxy && anchor test && popd
- pushd tests/multisig && anchor test && popd
- pushd tests/interface && anchor test && popd
- pushd tests/lockup && anchor test && popd
- pushd tests/permissioned-markets/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
- <<: *tests
name: Runs the e2e tests 2
script:
- pushd examples/misc && anchor test && popd
- pushd examples/events && anchor test && popd
- pushd examples/cashiers-check && anchor test && popd
- pushd examples/typescript && yarn && anchor test && popd
- pushd examples/zero-copy && yarn && anchor test && popd
- pushd examples/chat && yarn && anchor test && popd
- pushd examples/ido-pool && yarn && anchor test && popd
- pushd examples/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
- pushd examples/cfo && anchor run test-with-build && popd
- <<: *examples
name: Runs the examples 3
- pushd tests/misc && anchor test && popd
- pushd tests/events && anchor test && popd
- pushd tests/cashiers-check && anchor test && popd
- pushd tests/typescript && yarn && anchor test && popd
- pushd tests/zero-copy && yarn && anchor test && popd
- pushd tests/chat && yarn && anchor test && popd
- pushd tests/ido-pool && yarn && anchor test && popd
- pushd tests/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
- pushd tests/cfo && anchor run test-with-build && popd
- <<: *tests
name: Runs the e2e tests 3
script:
- pushd examples/escrow && yarn && anchor test && popd
- pushd examples/pyth && yarn && anchor test && popd
- pushd tests/escrow && yarn && anchor test && popd
- pushd tests/pyth && yarn && anchor test && popd
- pushd examples/tutorial/basic-0 && anchor test && popd
- pushd examples/tutorial/basic-1 && anchor test && popd
- pushd examples/tutorial/basic-2 && anchor test && popd
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ members = [
"spl",
]
exclude = [
"examples/swap/deps/serum-dex",
"examples/cfo/deps/serum-dex",
"examples/permissioned-markets/deps/serum-dex",
"tests/swap/deps/serum-dex",
"tests/cfo/deps/serum-dex",
"tests/permissioned-markets/deps/serum-dex",
]
4 changes: 2 additions & 2 deletions client/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ edition = "2018"
anchor-client = { path = "../" }
basic-2 = { path = "../../examples/tutorial/basic-2/programs/basic-2", features = ["no-entrypoint"] }
basic-4 = { path = "../../examples/tutorial/basic-4/programs/basic-4", features = ["no-entrypoint"] }
composite = { path = "../../examples/composite/programs/composite", features = ["no-entrypoint"] }
events = { path = "../../examples/events/programs/events", features = ["no-entrypoint"] }
composite = { path = "../../tests/composite/programs/composite", features = ["no-entrypoint"] }
events = { path = "../../tests/events/programs/events", features = ["no-entrypoint"] }
shellexpand = "2.1.0"
anyhow = "1.0.32"
rand = "0.7.3"
Expand Down
4 changes: 2 additions & 2 deletions client/example/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ main() {
#
# Deploy programs.
#
pushd ../../examples/composite/
pushd ../../tests/composite/
anchor build
anchor deploy
local composite_pid=$(cat target/idl/composite.json | jq -r .metadata.address)
Expand All @@ -43,7 +43,7 @@ main() {
anchor deploy
local basic_4_pid=$(cat target/idl/basic_4.json | jq -r .metadata.address)
popd
pushd ../../examples/events
pushd ../../tests/events
anchor build
anchor deploy
local events_pid=$(cat target/idl/events.json | jq -r .metadata.address)
Expand Down
5 changes: 2 additions & 3 deletions examples/README.md → tests/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Examples
# Tests

The examples presented here are for educational purposes only. No program
here is guaranteed to be safe or secure in any way. In many cases, they are
No program here is guaranteed to be safe or secure in any way. In most cases, they are
simply just simple integration tests to illustrate some particular functionality
of the framework. If used, one should audit any programs used and take full
responsibility for the consequences that occur due to any outstanding bugs
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5d8b476

Please sign in to comment.