Add /tests dir (#676)

This commit is contained in:
Armani Ferrante 2021-09-04 05:33:39 -07:00 committed by GitHub
parent ea292e39b5
commit 5d8b4765f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
191 changed files with 42 additions and 41 deletions

2
.gitignore vendored
View File

@ -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/

10
.gitmodules vendored
View File

@ -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

View File

@ -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
@ -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

View File

@ -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",
]

View File

@ -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"

View File

@ -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)
@ -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)

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More