浏览代码

Integration tests: Require contract names to be unique (#1228)

Cyrill Leutwiler 2 年之前
父节点
当前提交
242c187fa9
共有 2 个文件被更改,包括 12 次插入1 次删除
  1. 11 0
      integration/substrate/build.sh
  2. 1 1
      integration/substrate/package.json

+ 11 - 0
integration/substrate/build.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e 
+
+dup_contracts=$(grep -r '^contract .* {' | awk '{ print $2 }' | sort | uniq -d)
+if [[ $dup_contracts ]]; then
+	echo "Found contract with duplicate names: ${dup_contracts}"
+	/bin/false
+else
+	parallel solang compile -v -g --target substrate --log-runtime-errors --math-overflow --log-api-return-codes ::: *.sol test/*.sol
+fi
+

+ 1 - 1
integration/substrate/package.json

@@ -5,7 +5,7 @@
   "main": "index.js",
   "main": "index.js",
   "scripts": {
   "scripts": {
     "test": "tsc; ts-mocha -t 20000 *.spec.ts",
     "test": "tsc; ts-mocha -t 20000 *.spec.ts",
-    "build": "parallel solang compile -v -g --target substrate --log-runtime-errors --math-overflow --log-api-return-codes ::: *.sol test/*.sol",
+    "build": "./build.sh",
     "build-ink": "docker run --rm -v $(pwd)/ink/caller:/opt/contract paritytech/contracts-ci-linux@sha256:2eaa0869c562adabcfc011a2f3ad6b2289cdd0b3a8923e24d29efd4452b397de cargo contract build --manifest-path /opt/contract/Cargo.toml"
     "build-ink": "docker run --rm -v $(pwd)/ink/caller:/opt/contract paritytech/contracts-ci-linux@sha256:2eaa0869c562adabcfc011a2f3ad6b2289cdd0b3a8923e24d29efd4452b397de cargo contract build --manifest-path /opt/contract/Cargo.toml"
   },
   },
   "contributors": [
   "contributors": [