As reported in #1537, different versions of glslangValidator do not output the same error messages as they do not use the same default type for undeclared variables. This PR removes an error from the glsl code (or fix it if you prefer) so different versions of the tools have the same output. There are still many more errors to check that the integration of the tool within nitc works.
Fix #1537.
Pull-Request: #1643
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
`}
redef class String
- # returns the md5 digest of the receiver string
- # algorithm implemented by L. Peter Deutsch <ghost@aladdin.com>
- fun md5: String import String.to_cstring, NativeString.to_s `{
+ # MD5 digest of `self`
+ #
+ # ~~~
+ # assert "".md5 == "d41d8cd98f00b204e9800998ecf8427e"
+ # assert "a".md5 == "0cc175b9c0f1b6a831c399e269772661"
+ # assert "abc".md5 == "900150983cd24fb0d6963f7d28e17f72"
+ # ~~~
+ fun md5: String do return to_cstring.native_md5.to_s
+end
+
+redef class NativeString
+ private fun native_md5: NativeString `{
md5_state_t state;
md5_byte_t digest[16]; /* result */
char *hex_output = malloc(33*sizeof(char));
int di;
- char *in_text;
-
- in_text = String_to_cstring(self);
md5_init(&state);
- md5_append(&state, (const md5_byte_t *)in_text, strlen(in_text));
+ md5_append(&state, (const md5_byte_t *)self, strlen(self));
md5_finish(&state, digest);
for (di = 0; di < 16; ++di)
sprintf(hex_output + di * 2, "%02x", digest[di]);
hex_output[32] = '\0';
- return NativeString_to_s(hex_output);
+ return hex_output;
`}
end
dir=`dirname "$p"`
name=`basename "$dir"`
echo "*** make $dir ***"
- if misc/jenkins/unitrun.sh "run-$name-make" make -C "$dir"; then
+ if misc/jenkins/unitrun.sh "cmd-$name-make" make -C "$dir"; then
# Make OK, is there a `check` rule?
make -C "$dir" check -n 2>/dev/null || continue
echo "*** makecheck $dir ***"
- if misc/jenkins/unitrun.sh "run-$name-makecheck" make -C "$dir" check; then
+ if misc/jenkins/unitrun.sh "cmd-$name-makecheck" make -C "$dir" check; then
:
else
failed="$failed $name-check"
# limitations under the License.
# Check missing "This file is part of NIT…" comment in committed scripts.
+#
+# Usage: checklicense.sh from to
-if test "$#" -lt 2; then
- echo "Usage: checklicense from to"
- echo ""
- exit
-fi
+set -e
-from=$1
-to=$2
+from=${1:-origin/master}
+to=${2:-HEAD}
err=0
+cd `git rev-parse --show-toplevel`
+
+echo "checklicense $from (`git rev-parse "$from"`) .. $to (`git rev-parse "$to"`)"
git diff --name-status $from..$to -- "*.nit" "*.sh" | sed -n 's/^A\s*//p' > checklicense_new_files.out
-test -s checklicense_new_files.out || exit 0
-grep -L '\(^\|\b\)# [Tt]his file is part of NIT ' `cat checklicense_new_files.out` 2>/dev/null | tee checklicense_missing.out
-test \! -s checklicense_missing.out
+if test \! -s checklicense_new_files.out; then
+ echo "No new files"
+ exit 0
+fi
+grep -L '\(^\|\b\)# [Tt]his file is part of NIT ' `cat checklicense_new_files.out` 2>/dev/null > checklicense_missing.out || true
+if test -s checklicense_missing.out; then
+ echo "These files are missing their licence:"
+ echo ""
+ cat checklicense_missing.out
+ echo ""
+ echo "Please double check that the licence text (i.e. \`This file is part of NIT...\`) is included at the begin of these files."
+ exit 1
+else
+ echo "All `cat checklicense_new_files.out | wc -l` checked new files have a correct license."
+ exit 0
+fi
# limitations under the License.
# Check missing signed-off-by in commits
+# Usage: checksignedoffby from to
-if test "$#" -lt 2; then
- echo "Usage: checksignedoffby from to"
- echo ""
- exit
-fi
+set -e
-from=$1
-to=$2
+from=${1:-origin/master}
+to=${2:-HEAD}
err=0
+cd `git rev-parse --show-toplevel`
+
+echo "checksignedoffby $from (`git rev-parse "$from"`) .. $to (`git rev-parse "$to"`)"
for ref in `git rev-list --no-merges "$from".."$to"`; do
# What is the expected?
sig=`git --no-pager show -s --format='Signed-off-by: %an <%ae>' $ref`
# Do we found some signed-off-by?
git --no-pager show -s --format="%b" $ref | grep "^Signed-off-by:" > check_signedoff_list.out || {
+ echo ""
+ echo "Missing $sig for commit"
git --no-pager show -s --oneline $ref
- echo "Missing $sig"
err=1
continue
}
# Do we found the expected thing?
cat check_signedoff_list.out | grep -q "^$sig\$" && continue
+ echo ""
+ echo "Bad or missing Signed-off-by for commit"
git --no-pager show -s --oneline $ref
- echo "Bad or missing $sig; got:"
+ echo "Expected (from local git config):"
+ echo "$sig"
+ echo "Got:"
cat check_signedoff_list.out
err=1
done
rm check_signedoff_list.out 2> /dev/null
+if test "$err" = 1; then
+ echo ""
+ echo "Please check that each commit contains a \`Signed-off-by:\` statement that matches the author's name and email."
+ echo "Note that existing commits should be amended; pushing new commit is not sufficient."
+fi
+
exit $err
--- /dev/null
+#!/bin/bash
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Check whitespace errors in commits
+# Usage: checkwhitespaces from to
+#
+# This script is in fact a more friendly version of `git log --check`
+
+set -e
+
+from=${1:-origin/master}
+to=${2:-HEAD}
+
+err=0
+
+cd `git rev-parse --show-toplevel`
+
+echo "checkwhitespaces $from (`git rev-parse "$from"`) .. $to (`git rev-parse "$to"`)"
+for ref in `git rev-list --no-merges "$from".."$to"`; do
+ # Show nothing if no error
+ if git --no-pager show --check --oneline $ref > /dev/null; then
+ continue
+ fi
+
+ # Run the command again to display things
+ echo ""
+ echo "Found whitespace errors in commit"
+ git --no-pager show --check --oneline $ref || true
+ err=1
+done
+
+if test "$err" = 1; then
+ echo ""
+ echo "Please check that each file in each commit does not contain whitespace errors."
+ echo "Note that existing commits should be amended; pushing new commit is not sufficient."
+ echo "Hint: use \"git log --check\" to see whitespace errors."
+fi
+
+exit $err
fi
# Make basic bootstrap
-$tools_dir/unitrun.sh "run-make-csrc" make -C c_src
-$tools_dir/unitrun.sh "run-make-version" src/git-gen-version.sh
-$tools_dir/unitrun.sh "run-make-nitc_0" c_src/nitc -o bin/nitc_0 src/nitc.nit
-$tools_dir/unitrun.sh "run-make-nitc" bin/nitc_0 --dir bin/ src/nitc.nit
-$tools_dir/unitrun.sh "run-make-nit-and-nitvm" bin/nitc --dir bin/ src/nit.nit src/nitvm.nit
+$tools_dir/unitrun.sh "cmd-make-csrc" make -C c_src
+$tools_dir/unitrun.sh "cmd-make-version" src/git-gen-version.sh
+$tools_dir/unitrun.sh "cmd-make-nitc_0" c_src/nitc -o bin/nitc_0 src/nitc.nit
+$tools_dir/unitrun.sh "cmd-make-nitc" bin/nitc_0 --dir bin/ src/nitc.nit
+$tools_dir/unitrun.sh "cmd-make-nit-and-nitvm" bin/nitc --dir bin/ src/nit.nit src/nitvm.nit
# Make nitester
-$tools_dir/unitrun.sh "run-make-nitester" make -C contrib/nitester/
+$tools_dir/unitrun.sh "cmd-make-nitester" make -C contrib/nitester/
# Run tests
cd tests
echo >> "${name}.xml" "<error message='Command returned $res'/>"
echo "+ Command returned $res" >&2
fi
+if test -s "${name}.out"; then
cat >> "${name}.xml"<<END
<system-out><![CDATA[
`cat -v ${name}.out`
]]></system-out>
+END
+fi
+if test -s "${name}.2.out"; then
+cat >> "${name}.xml"<<END
<system-err><![CDATA[
`cat -v ${name}.2.out`
]]></system-err>
+END
+fi
+cat >> "${name}.xml"<<END
</testcase>
</testsuite></testsuites>
END
# Link everything in a shared library
# TODO customize the compiler
- var cmd = "{v.c_compiler} -Wall -shared -Wl,-soname,{mmodule.name}.so -g -o {foreign_code_lib_path} {object_files.join(" ")} {ldflags}"
+ var cmd = "{v.c_compiler} -Wall -shared -o {foreign_code_lib_path} {object_files.join(" ")} {ldflags}"
if sys.system(cmd) != 0 then
v.fatal "FFI Error: Failed to link native code using `{cmd}`"
return false
Error: package `glesv1_cm` unknown by `pkg-config`, make sure the development package is be installed
Error: package `glesv2` unknown by `pkg-config`, make sure the development package is be installed
fatal error: 'libintl.h' file not found
-ld: unknown option: -soname