123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #!/usr/bin/env bash
- set -x
- set -e
- # Run anchor test
- anchor test --skip-lint
- idls_dir=idls
- tmp_dir=$(mktemp -d)
- cd programs/idl
- anchor idl parse --file src/lib.rs -o $tmp_dir/idl_parse_act.json
- anchor idl build -o $tmp_dir/idl_build_act.json
- cd ../generics
- anchor idl build -o $tmp_dir/generics_build_act.json
- cd ../relations-derivation
- anchor idl build -o $tmp_dir/relations_build_act.json
- cd ../..
- echo "----------------------------------------------------"
- echo "idl parse before > after"
- echo "----------------------------------------------------"
- echo ""
- diff -y --color $idls_dir/idl_parse_exp.json $tmp_dir/idl_parse_act.json
- PARSE_RETCODE=$?
- echo ""
- echo ""
- echo "----------------------------------------------------"
- echo "idl build before > after"
- echo "----------------------------------------------------"
- echo ""
- diff -y --color $idls_dir/idl_build_exp.json $tmp_dir/idl_build_act.json
- GEN_RETCODE=$?
- echo ""
- echo ""
- echo "----------------------------------------------------"
- echo "idl generics build before > after"
- echo "----------------------------------------------------"
- echo ""
- diff -y --color $idls_dir/generics_build_exp.json $tmp_dir/generics_build_act.json
- GEN_GENERICS_RETCODE=$?
- echo ""
- echo ""
- echo "----------------------------------------------------"
- echo "idl relations build before > after"
- echo "----------------------------------------------------"
- echo ""
- diff -y --color $idls_dir/relations_build_exp.json $tmp_dir/relations_build_act.json
- GEN_RELATIONS_RETCODE=$?
- # returns 0 when ok, or a positive integer when there are differences
- exit $((PARSE_RETCODE+GEN_RETCODE+GEN_GENERICS_RETCODE+GEN_RELATIONS_RETCODE))
|