sassc 2.0.1 → 2.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitmodules +1 -1
- data/.travis.yml +7 -3
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +1 -1
- data/Rakefile +23 -8
- data/ext/extconf.rb +39 -0
- data/ext/libsass/.gitignore +1 -0
- data/ext/libsass/GNUmakefile.am +23 -39
- data/ext/libsass/Makefile +56 -91
- data/ext/libsass/Makefile.conf +16 -2
- data/ext/libsass/configure.ac +8 -12
- data/ext/libsass/include/sass/base.h +1 -0
- data/ext/libsass/include/sass/context.h +1 -1
- data/ext/libsass/src/GNUmakefile.am +1 -5
- data/ext/libsass/src/ast.cpp +747 -2010
- data/ext/libsass/src/ast.hpp +239 -2383
- data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
- data/ext/libsass/src/ast2c.hpp +39 -0
- data/ext/libsass/src/ast_def_macros.hpp +62 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +1 -0
- data/ext/libsass/src/ast_fwd_decl.hpp +43 -165
- data/ext/libsass/src/ast_sel_cmp.cpp +909 -0
- data/ext/libsass/src/ast_sel_unify.cpp +280 -0
- data/ext/libsass/src/ast_selectors.cpp +1475 -0
- data/ext/libsass/src/ast_selectors.hpp +568 -0
- data/ext/libsass/src/ast_supports.cpp +130 -0
- data/ext/libsass/src/ast_supports.hpp +121 -0
- data/ext/libsass/src/ast_values.cpp +967 -0
- data/ext/libsass/src/ast_values.hpp +489 -0
- data/ext/libsass/src/backtrace.cpp +4 -0
- data/ext/libsass/src/base64vlq.cpp +3 -0
- data/ext/libsass/src/bind.cpp +18 -17
- data/ext/libsass/src/bind.hpp +3 -1
- data/ext/libsass/src/c2ast.cpp +64 -0
- data/ext/libsass/src/c2ast.hpp +14 -0
- data/ext/libsass/src/cencode.c +2 -2
- data/ext/libsass/src/check_nesting.cpp +52 -56
- data/ext/libsass/src/check_nesting.hpp +35 -34
- data/ext/libsass/src/color_maps.cpp +156 -153
- data/ext/libsass/src/color_maps.hpp +152 -152
- data/ext/libsass/src/constants.cpp +15 -0
- data/ext/libsass/src/constants.hpp +13 -0
- data/ext/libsass/src/context.cpp +24 -14
- data/ext/libsass/src/context.hpp +6 -6
- data/ext/libsass/src/cssize.cpp +69 -71
- data/ext/libsass/src/cssize.hpp +50 -50
- data/ext/libsass/src/debugger.hpp +117 -110
- data/ext/libsass/src/emitter.cpp +13 -12
- data/ext/libsass/src/emitter.hpp +13 -9
- data/ext/libsass/src/environment.cpp +15 -1
- data/ext/libsass/src/environment.hpp +6 -0
- data/ext/libsass/src/error_handling.cpp +36 -59
- data/ext/libsass/src/error_handling.hpp +29 -16
- data/ext/libsass/src/eval.cpp +302 -323
- data/ext/libsass/src/eval.hpp +64 -55
- data/ext/libsass/src/expand.cpp +94 -88
- data/ext/libsass/src/expand.hpp +33 -37
- data/ext/libsass/src/extend.cpp +38 -36
- data/ext/libsass/src/extend.hpp +15 -15
- data/ext/libsass/src/file.cpp +34 -2
- data/ext/libsass/src/fn_colors.cpp +594 -0
- data/ext/libsass/src/fn_colors.hpp +85 -0
- data/ext/libsass/src/fn_lists.cpp +284 -0
- data/ext/libsass/src/fn_lists.hpp +34 -0
- data/ext/libsass/src/fn_maps.cpp +94 -0
- data/ext/libsass/src/fn_maps.hpp +30 -0
- data/ext/libsass/src/fn_miscs.cpp +256 -0
- data/ext/libsass/src/fn_miscs.hpp +40 -0
- data/ext/libsass/src/fn_numbers.cpp +220 -0
- data/ext/libsass/src/fn_numbers.hpp +45 -0
- data/ext/libsass/src/fn_selectors.cpp +235 -0
- data/ext/libsass/src/fn_selectors.hpp +35 -0
- data/ext/libsass/src/fn_strings.cpp +254 -0
- data/ext/libsass/src/fn_strings.hpp +34 -0
- data/ext/libsass/src/fn_utils.cpp +156 -0
- data/ext/libsass/src/fn_utils.hpp +56 -0
- data/ext/libsass/src/inspect.cpp +101 -152
- data/ext/libsass/src/inspect.hpp +69 -73
- data/ext/libsass/src/json.cpp +2 -2
- data/ext/libsass/src/lexer.cpp +6 -3
- data/ext/libsass/src/listize.cpp +9 -11
- data/ext/libsass/src/listize.hpp +11 -7
- data/ext/libsass/src/memory/SharedPtr.cpp +2 -83
- data/ext/libsass/src/memory/SharedPtr.hpp +127 -143
- data/ext/libsass/src/node.cpp +13 -10
- data/ext/libsass/src/node.hpp +3 -3
- data/ext/libsass/src/operation.hpp +184 -144
- data/ext/libsass/src/operators.cpp +43 -17
- data/ext/libsass/src/operators.hpp +5 -5
- data/ext/libsass/src/output.cpp +21 -18
- data/ext/libsass/src/output.hpp +14 -21
- data/ext/libsass/src/parser.cpp +215 -183
- data/ext/libsass/src/parser.hpp +28 -24
- data/ext/libsass/src/plugins.cpp +5 -1
- data/ext/libsass/src/position.cpp +3 -0
- data/ext/libsass/src/prelexer.cpp +9 -3
- data/ext/libsass/src/prelexer.hpp +9 -9
- data/ext/libsass/src/remove_placeholders.cpp +14 -11
- data/ext/libsass/src/remove_placeholders.hpp +8 -9
- data/ext/libsass/src/sass.cpp +9 -3
- data/ext/libsass/src/sass.hpp +12 -9
- data/ext/libsass/src/sass2scss.cpp +45 -14
- data/ext/libsass/src/sass_context.cpp +18 -15
- data/ext/libsass/src/sass_functions.cpp +6 -3
- data/ext/libsass/src/sass_functions.hpp +1 -1
- data/ext/libsass/src/sass_util.cpp +3 -0
- data/ext/libsass/src/sass_values.cpp +21 -13
- data/ext/libsass/src/source_map.cpp +5 -2
- data/ext/libsass/src/source_map.hpp +2 -2
- data/ext/libsass/src/subset_map.cpp +4 -1
- data/ext/libsass/src/to_value.cpp +23 -21
- data/ext/libsass/src/to_value.hpp +18 -22
- data/ext/libsass/src/units.cpp +4 -0
- data/ext/libsass/src/units.hpp +1 -0
- data/ext/libsass/src/utf8/checked.h +12 -10
- data/ext/libsass/src/utf8/core.h +3 -0
- data/ext/libsass/src/utf8_string.cpp +3 -0
- data/ext/libsass/src/util.cpp +67 -75
- data/ext/libsass/src/util.hpp +64 -19
- data/ext/libsass/src/util_string.cpp +75 -0
- data/ext/libsass/src/util_string.hpp +19 -0
- data/ext/libsass/src/values.cpp +22 -13
- data/ext/libsass/src/values.hpp +2 -2
- data/ext/libsass/win/libsass.targets +30 -4
- data/ext/libsass/win/libsass.vcxproj.filters +82 -4
- data/lib/sassc.rb +24 -0
- data/lib/sassc/engine.rb +2 -2
- data/lib/sassc/native.rb +8 -1
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +19 -11
- data/test/engine_test.rb +26 -1
- data/test/native_test.rb +1 -1
- metadata +66 -72
- data/ext/Rakefile +0 -3
- data/ext/libsass/.github/CONTRIBUTING.md +0 -65
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
- data/ext/libsass/.travis.yml +0 -64
- data/ext/libsass/Readme.md +0 -104
- data/ext/libsass/SECURITY.md +0 -10
- data/ext/libsass/appveyor.yml +0 -91
- data/ext/libsass/docs/README.md +0 -20
- data/ext/libsass/docs/api-context-example.md +0 -45
- data/ext/libsass/docs/api-context-internal.md +0 -163
- data/ext/libsass/docs/api-context.md +0 -295
- data/ext/libsass/docs/api-doc.md +0 -215
- data/ext/libsass/docs/api-function-example.md +0 -67
- data/ext/libsass/docs/api-function-internal.md +0 -8
- data/ext/libsass/docs/api-function.md +0 -74
- data/ext/libsass/docs/api-importer-example.md +0 -112
- data/ext/libsass/docs/api-importer-internal.md +0 -20
- data/ext/libsass/docs/api-importer.md +0 -86
- data/ext/libsass/docs/api-value-example.md +0 -55
- data/ext/libsass/docs/api-value-internal.md +0 -76
- data/ext/libsass/docs/api-value.md +0 -154
- data/ext/libsass/docs/build-on-darwin.md +0 -27
- data/ext/libsass/docs/build-on-gentoo.md +0 -55
- data/ext/libsass/docs/build-on-windows.md +0 -139
- data/ext/libsass/docs/build-shared-library.md +0 -35
- data/ext/libsass/docs/build-with-autotools.md +0 -78
- data/ext/libsass/docs/build-with-makefiles.md +0 -68
- data/ext/libsass/docs/build-with-mingw.md +0 -107
- data/ext/libsass/docs/build-with-visual-studio.md +0 -90
- data/ext/libsass/docs/build.md +0 -97
- data/ext/libsass/docs/compatibility-plan.md +0 -48
- data/ext/libsass/docs/contributing.md +0 -17
- data/ext/libsass/docs/custom-functions-internal.md +0 -122
- data/ext/libsass/docs/dev-ast-memory.md +0 -223
- data/ext/libsass/docs/implementations.md +0 -56
- data/ext/libsass/docs/plugins.md +0 -47
- data/ext/libsass/docs/setup-environment.md +0 -68
- data/ext/libsass/docs/source-map-internals.md +0 -51
- data/ext/libsass/docs/trace.md +0 -26
- data/ext/libsass/docs/triage.md +0 -17
- data/ext/libsass/docs/unicode.md +0 -39
- data/ext/libsass/extconf.rb +0 -6
- data/ext/libsass/script/bootstrap +0 -13
- data/ext/libsass/script/branding +0 -10
- data/ext/libsass/script/ci-build-libsass +0 -134
- data/ext/libsass/script/ci-build-plugin +0 -62
- data/ext/libsass/script/ci-install-compiler +0 -6
- data/ext/libsass/script/ci-install-deps +0 -20
- data/ext/libsass/script/ci-report-coverage +0 -42
- data/ext/libsass/script/spec +0 -5
- data/ext/libsass/script/tap-driver +0 -652
- data/ext/libsass/script/tap-runner +0 -1
- data/ext/libsass/script/test-leaks.pl +0 -103
- data/ext/libsass/src/functions.cpp +0 -2234
- data/ext/libsass/src/functions.hpp +0 -198
- data/ext/libsass/src/to_c.hpp +0 -39
- data/ext/libsass/test/test_node.cpp +0 -94
- data/ext/libsass/test/test_paths.cpp +0 -28
- data/ext/libsass/test/test_selector_difference.cpp +0 -25
- data/ext/libsass/test/test_specificity.cpp +0 -25
- data/ext/libsass/test/test_subset_map.cpp +0 -472
- data/ext/libsass/test/test_superselector.cpp +0 -69
- data/ext/libsass/test/test_unification.cpp +0 -31
- data/lib/tasks/libsass.rb +0 -33
data/ext/libsass/docs/trace.md
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
## This is proposed interface in https://github.com/sass/libsass/pull/1288
|
2
|
-
|
3
|
-
Additional debugging macros with low overhead are available, `TRACE()` and `TRACEINST()`.
|
4
|
-
|
5
|
-
Both macros simulate a string stream, so they can be used like this:
|
6
|
-
|
7
|
-
TRACE() << "Reached.";
|
8
|
-
|
9
|
-
produces:
|
10
|
-
|
11
|
-
[LibSass] parse_value parser.cpp:1384 Reached.
|
12
|
-
|
13
|
-
`TRACE()`
|
14
|
-
logs function name, source filename, source file name to the standard error and the attached
|
15
|
-
stream to the standard error.
|
16
|
-
|
17
|
-
`TRACEINST(obj)`
|
18
|
-
logs object instance address, function name, source filename, source file name to the standard error and the attached stream to the standard error, for example:
|
19
|
-
|
20
|
-
TRACEINST(this) << "String_Constant created " << this;
|
21
|
-
|
22
|
-
produces:
|
23
|
-
|
24
|
-
[LibSass] 0x8031ba980:String_Constant ./ast.hpp:1371 String_Constant created (0,"auto")
|
25
|
-
|
26
|
-
The macros generate output only of `LibSass_TRACE` is set in the environment.
|
data/ext/libsass/docs/triage.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
This is an article about how to help with LibSass issues. Issue triage is a fancy word for explaining how we deal with incoming issues and make sure that the right problems get worked on. The lifecycle of an issue goes like this:
|
2
|
-
|
3
|
-
1. Issue is reported by a user.
|
4
|
-
2. If the issue seems like a bug, then the "bug" tag is added.
|
5
|
-
3. If the reporting user didn't also create a spec test over at sass/sass-spec, the "needs test" tag is added.
|
6
|
-
4. Verify that Ruby Sass *does not* have the same bug. LibSass strives to be an exact replica of how Ruby Sass works. If it's an issue that neither project has solved, please close the ticket with the "not in sass" label.
|
7
|
-
5. The smallest possible breaking test is created in sass-spec. Cut away any extra information or non-breaking code until the core issue is made clear.
|
8
|
-
6. Again, verify that the expected output matches the latest Ruby Sass release. Do this by using your own tool OR by running ./sass-spec.rb in the spec folder and making sure that your test passes!
|
9
|
-
7. Create the test cases in sass-spec with the name spec/LibSass-todo-issues/issue_XXX/input.scss and expected_output.css where the XXX is the issue number here.
|
10
|
-
8. Commit that test to sass-spec, making sure to reference the issue in the comment message like "Test to demonstrate sass/LibSass#XXX".
|
11
|
-
9. Once the spec test exists, remove the "needs test" tag and replace it with "test written".
|
12
|
-
10. A C++ developer will then work on the issue and issue a pull request to fix the issue.
|
13
|
-
11. A core member verifies that the fix does actually fix the spec tests.
|
14
|
-
12. The fix is merged into the project.
|
15
|
-
13. The spec is moved from the LibSass-todo-issues folder into LibSass-closed-issues
|
16
|
-
14. The issue is closed
|
17
|
-
15. Have a soda pop or enjoyable beverage of your choice
|
data/ext/libsass/docs/unicode.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
LibSass currently expects all input to be utf8 encoded (and outputs only utf8), if you actually have any unicode characters at all. We do not support conversion between encodings, even if you declare it with a `@charset` rule. The text below was originally posted as an [issue](https://github.com/sass/libsass/issues/381) on the LibSass tracker.
|
2
|
-
|
3
|
-
### [Declaring character encodings in CSS](http://www.w3.org/International/questions/qa-css-charset.en)
|
4
|
-
|
5
|
-
This [explains](http://www.w3.org/International/questions/qa-css-charset.en) how the character encoding of a css file is determined. Since we are only dealing with local files, we never have a HTTP header. So the precedence should be 'charset' rule, byte-order mark (BOM) or auto-detection (finally falling back to system default/UTF-8). This may not sound too hard to implement, but what about import rules? The CSS specs do not forbid the mixing of different encodings! I solved that by converting all files to UTF-8 internally. On writing there is an option to tell the tool what encoding it should be (UTF-8 by default). One can also define if it should write a BOM or not and if it should add the charset declaration.
|
6
|
-
|
7
|
-
Since my tool is written in perl, I have a lot of utilities at hand to deal with different unicode charsets. I'm pretty sure that most OSS uses [libiconv](https://www.gnu.org/software/libiconv/) to convert between different encodings. But I have now idea how easy/hard this would be to integrate platform independent (it seems doable).
|
8
|
-
|
9
|
-
### Current status on LibSass unicode support
|
10
|
-
|
11
|
-
Currently LibSass seems to handle the common UTF-8 case pretty well. I believe it should correctly support all ASCII compatible encodings (like UTF-8 or Latin-1). If all includes use the same encoding, the output should be correct (in the same encoding). It should also handle unicode chars in [selectors, variable names and other identifiers](https://github.com/hcatlin/libsass/issues/244#issuecomment-34681227). This is true for all ASCII compatible encodings. So the main incompatible encodings (I'm aware of) are UTF-16/UTF-32 (which could be converted to UTF-8 with libiconv).
|
12
|
-
|
13
|
-
### Current encoding auto detection
|
14
|
-
|
15
|
-
LibSass currently reads all kind of BOMs and will error out if it finds something it doesn't know how to handle! It seems that it throws away the optional UTF-8 BOM (if any is found). IMO it would be nice if users could configure that (also if a charset rule should be added to the output).
|
16
|
-
|
17
|
-
### What is currently not supported
|
18
|
-
|
19
|
-
- Using non ASCII compatible encodings (like UTF-16)
|
20
|
-
- Using non ASCII characters in different encodings in different includes
|
21
|
-
|
22
|
-
### What is missing to support the above cases
|
23
|
-
|
24
|
-
- A way to convert between encodings (like libiconv)
|
25
|
-
- Sniffing the charset inside the file (source is available)
|
26
|
-
- Handling the conversion on import (and export)
|
27
|
-
- Optional: Make output encoding configurable
|
28
|
-
- Optional: Add optional/mandatory BOM (configurable)
|
29
|
-
|
30
|
-
### Low priority feature
|
31
|
-
|
32
|
-
I guess the current implementation should handle more than 99% of all real world use cases.
|
33
|
-
A) Unicode characters are still seldomly seen (as they can be written escaped)
|
34
|
-
B) It will still work if it's UTF-8 or in any of the most common known western ISO codepages.
|
35
|
-
Although I'm not sure how this applies to asian and other "exotic" codepages!
|
36
|
-
|
37
|
-
I guess the biggest Problem is to have libiconv (or some other) library as a dependency. Since it contains a lot of rules for the conversions, I see it as the only way to handle this correctly. Once that is sorted out it should be pretty much straight forward to implement the missing pieces (in parser.cpp - Parser::parse should return encoding and add Parser::sniff_charset, then convert the source byte stream to UTF-8).
|
38
|
-
|
39
|
-
I hope the statements above all hold true. Unicode is really not the easiest topic to wrap your head around. But since I did all the above recently in Perl, I wanted to document it here. Feel free to extend or criticize.
|
data/ext/libsass/extconf.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
script/branding
|
4
|
-
|
5
|
-
: ${SASS_SPEC_PATH:="sass-spec"}
|
6
|
-
: ${SASS_SASSC_PATH:="sassc" }
|
7
|
-
|
8
|
-
if [ ! -d $SASS_SPEC_PATH ]; then
|
9
|
-
git clone https://github.com/sass/sass-spec.git $SASS_SPEC_PATH
|
10
|
-
fi
|
11
|
-
if [ ! -d $SASS_SASSC_PATH ]; then
|
12
|
-
git clone https://github.com/sass/sassc.git $SASS_SASSC_PATH
|
13
|
-
fi
|
data/ext/libsass/script/branding
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#! /bin/bash
|
2
|
-
|
3
|
-
echo " "
|
4
|
-
echo " _ ___ ____ ____ _ ____ ____ "
|
5
|
-
echo "| | |_ _| __ ) ___| / \ / ___/ ___| "
|
6
|
-
echo "| | | || _ \___ \ / _ \ \___ \___ \ "
|
7
|
-
echo "| |___ | || |_) |__) / ___ \ ___) |__) |"
|
8
|
-
echo "|_____|___|____/____/_/ \_\____/____/ "
|
9
|
-
echo " "
|
10
|
-
|
@@ -1,134 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
set -e
|
4
|
-
|
5
|
-
script/bootstrap
|
6
|
-
|
7
|
-
# export this path right here (was in script/spec before)
|
8
|
-
export SASS_LIBSASS_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
|
9
|
-
|
10
|
-
# use some defaults if not running under travis ci
|
11
|
-
if [ "x$CONTINUOUS_INTEGRATION" == "x" ]; then export CONTINUOUS_INTEGRATION=true; fi
|
12
|
-
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then export TRAVIS_BUILD_DIR=$(pwd); fi
|
13
|
-
if [ "x$SASS_SASSC_PATH" == "x" ]; then export SASS_SASSC_PATH=$(pwd)/sassc; fi
|
14
|
-
if [ "x$SASS_SPEC_PATH" == "x" ]; then export SASS_SPEC_PATH=$(pwd)/sass-spec; fi
|
15
|
-
|
16
|
-
# try to get the os name from uname (and filter via perl - probably not the most portable way?)
|
17
|
-
if [ "x$TRAVIS_OS_NAME" == "x" ]; then export TRAVIS_OS_NAME=`uname -s | perl -ne 'print lc \$1 if\(/^([a-zA-Z]+)/'\)`; fi
|
18
|
-
|
19
|
-
if [ "x$COVERAGE" == "xyes" ]; then
|
20
|
-
COVERAGE_OPT="--enable-coverage"
|
21
|
-
export EXTRA_CFLAGS="-fprofile-arcs -ftest-coverage"
|
22
|
-
export EXTRA_CXXFLAGS="-fprofile-arcs -ftest-coverage"
|
23
|
-
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
24
|
-
# osx doesn't seem to know gcov lib?
|
25
|
-
export EXTRA_LDFLAGS="--coverage"
|
26
|
-
else
|
27
|
-
export EXTRA_LDFLAGS="-lgcov --coverage"
|
28
|
-
fi
|
29
|
-
else
|
30
|
-
COVERAGE_OPT="--disable-coverage"
|
31
|
-
fi
|
32
|
-
|
33
|
-
if [ "x$BUILD" == "xstatic" ]; then
|
34
|
-
SHARED_OPT="--disable-shared --enable-static"
|
35
|
-
MAKE_TARGET="static"
|
36
|
-
else
|
37
|
-
# Makefile of sassc wants to link to static
|
38
|
-
SHARED_OPT="--enable-shared --enable-static"
|
39
|
-
MAKE_TARGET="shared"
|
40
|
-
fi
|
41
|
-
|
42
|
-
if [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
|
43
|
-
MAKE_OPTS="$MAKE_OPTS -j1 V=1"
|
44
|
-
else
|
45
|
-
MAKE_OPTS="$MAKE_OPTS -j5 V=1"
|
46
|
-
fi
|
47
|
-
|
48
|
-
if [ "x$PREFIX" == "x" ]; then
|
49
|
-
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then
|
50
|
-
PREFIX=$SASS_LIBSASS_PATH/build
|
51
|
-
else
|
52
|
-
PREFIX=$TRAVIS_BUILD_DIR/build
|
53
|
-
fi
|
54
|
-
fi
|
55
|
-
|
56
|
-
# enable address sanitation
|
57
|
-
# https://en.wikipedia.org/wiki/AddressSanitizer
|
58
|
-
if [ "x$CC" == "xclang" ]; then
|
59
|
-
if [ "x$COVERAGE" != "xyes" ]; then
|
60
|
-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
61
|
-
export EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=address"
|
62
|
-
export EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -fsanitize=address"
|
63
|
-
export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=address"
|
64
|
-
fi
|
65
|
-
fi
|
66
|
-
fi
|
67
|
-
|
68
|
-
echo SASS_LIBSASS_PATH: $SASS_LIBSASS_PATH
|
69
|
-
echo TRAVIS_BUILD_DIR: $TRAVIS_BUILD_DIR
|
70
|
-
echo SASS_SASSC_PATH: $SASS_SASSC_PATH
|
71
|
-
echo SASS_SPEC_PATH: $SASS_SPEC_PATH
|
72
|
-
echo INSTALL_LOCATION: $PREFIX
|
73
|
-
|
74
|
-
if [ "x$AUTOTOOLS" == "xyes" ]; then
|
75
|
-
|
76
|
-
echo -en 'travis_fold:start:configure\r'
|
77
|
-
autoreconf --force --install
|
78
|
-
./configure --enable-tests $COVERAGE_OPT \
|
79
|
-
--disable-silent-rules \
|
80
|
-
--with-sassc-dir=$SASS_SASSC_PATH \
|
81
|
-
--with-sass-spec-dir=$SASS_SPEC_PATH \
|
82
|
-
--prefix=$PREFIX \
|
83
|
-
${SHARED_OPT}
|
84
|
-
echo -en 'travis_fold:end:configure\r'
|
85
|
-
|
86
|
-
make $MAKE_OPTS clean
|
87
|
-
|
88
|
-
# install to prefix directory
|
89
|
-
PREFIX="$PREFIX" make $MAKE_OPTS install
|
90
|
-
|
91
|
-
else
|
92
|
-
|
93
|
-
make $MAKE_OPTS clean
|
94
|
-
|
95
|
-
fi
|
96
|
-
|
97
|
-
# install to prefix directory
|
98
|
-
PREFIX="$PREFIX" make $MAKE_OPTS install
|
99
|
-
|
100
|
-
ls -la $PREFIX/*
|
101
|
-
|
102
|
-
echo successfully compiled libsass
|
103
|
-
echo AUTOTOOLS=$AUTOTOOLS COVERAGE=$COVERAGE BUILD=$BUILD
|
104
|
-
|
105
|
-
if [ "$CONTINUOUS_INTEGRATION" == "true" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "x$TRAVIS_PULL_REQUEST" != "x" ] &&
|
106
|
-
([ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] || [ "$TRAVIS_OS_NAME" == "cygwin" ]);
|
107
|
-
then
|
108
|
-
|
109
|
-
echo "Fetching PR $TRAVIS_PULL_REQUEST"
|
110
|
-
|
111
|
-
JSON=$(curl -L -sS https://api.github.com/repos/sass/libsass/pulls/$TRAVIS_PULL_REQUEST)
|
112
|
-
|
113
|
-
if [[ $JSON =~ "API rate limit exceeded" ]];
|
114
|
-
then
|
115
|
-
echo "Travis rate limit on github exceeded"
|
116
|
-
echo "Retrying via 'special purpose proxy'"
|
117
|
-
JSON=$(curl -L -sS https://github-api-reverse-proxy.herokuapp.com/repos/sass/libsass/pulls/$TRAVIS_PULL_REQUEST)
|
118
|
-
fi
|
119
|
-
|
120
|
-
RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)"
|
121
|
-
|
122
|
-
if [[ $JSON =~ $RE_SPEC_PR ]];
|
123
|
-
then
|
124
|
-
SPEC_PR="${BASH_REMATCH[2]}"
|
125
|
-
echo "Fetching Sass Spec PR $SPEC_PR"
|
126
|
-
git -C sass-spec fetch -u origin pull/$SPEC_PR/head:ci-spec-pr-$SPEC_PR
|
127
|
-
git -C sass-spec checkout --force ci-spec-pr-$SPEC_PR
|
128
|
-
LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
|
129
|
-
else
|
130
|
-
LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
|
131
|
-
fi
|
132
|
-
else
|
133
|
-
LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
|
134
|
-
fi
|
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
PLUGIN=$1
|
4
|
-
RUBY_BIN=ruby
|
5
|
-
SASS_SPEC_PATH=sass-spec
|
6
|
-
SASSC_BIN=sassc/bin/sassc
|
7
|
-
SASS_SPEC_SPEC_DIR=plugins/libsass-${PLUGIN}/test
|
8
|
-
|
9
|
-
if [ -e ./tester ] ; then
|
10
|
-
SASSC_BIN=./tester
|
11
|
-
fi
|
12
|
-
|
13
|
-
if [ -d ./build/lib ] ; then
|
14
|
-
cp -a build/lib lib
|
15
|
-
fi
|
16
|
-
|
17
|
-
if [ "x$1" == "x" ] ; then
|
18
|
-
echo "No plugin name given"
|
19
|
-
exit 1
|
20
|
-
fi
|
21
|
-
|
22
|
-
if [ "x$COVERAGE" == "0" ] ; then
|
23
|
-
unset COVERAGE
|
24
|
-
fi
|
25
|
-
|
26
|
-
export EXTRA_CFLAGS=""
|
27
|
-
export EXTRA_CXXFLAGS=""
|
28
|
-
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
29
|
-
# osx doesn't seem to know gcov lib?
|
30
|
-
export EXTRA_LDFLAGS="--coverage"
|
31
|
-
else
|
32
|
-
export EXTRA_LDFLAGS="-lgcov --coverage"
|
33
|
-
fi
|
34
|
-
|
35
|
-
mkdir -p plugins
|
36
|
-
if [ ! -d plugins/libsass-${PLUGIN} ] ; then
|
37
|
-
git clone https://github.com/mgreter/libsass-${PLUGIN} plugins/libsass-${PLUGIN}
|
38
|
-
fi
|
39
|
-
if [ ! -d plugins/libsass-${PLUGIN}/build ] ; then
|
40
|
-
mkdir plugins/libsass-${PLUGIN}/build
|
41
|
-
fi
|
42
|
-
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
|
43
|
-
|
44
|
-
cd plugins/libsass-${PLUGIN}/build
|
45
|
-
cmake -G "Unix Makefiles" -D LIBSASS_DIR="../../.." ..
|
46
|
-
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
|
47
|
-
make VERBOSE=1 -j2
|
48
|
-
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
|
49
|
-
cd ../../..
|
50
|
-
|
51
|
-
# glob only works on paths relative to imports
|
52
|
-
if [ "x$PLUGIN" == "xglob" ]; then
|
53
|
-
${SASSC_BIN} --plugin-path plugins/libsass-${PLUGIN}/build ${SASS_SPEC_SPEC_DIR}/basic/input.scss > ${SASS_SPEC_SPEC_DIR}/basic/result.css
|
54
|
-
${SASSC_BIN} --plugin-path plugins/libsass-${PLUGIN}/build ${SASS_SPEC_SPEC_DIR}/basic/input.scss --sourcemap > /dev/null
|
55
|
-
else
|
56
|
-
cat ${SASS_SPEC_SPEC_DIR}/basic/input.scss | ${SASSC_BIN} --plugin-path plugins/libsass-${PLUGIN}/build -I ${SASS_SPEC_SPEC_DIR}/basic > ${SASS_SPEC_SPEC_DIR}/basic/result.css
|
57
|
-
cat ${SASS_SPEC_SPEC_DIR}/basic/input.scss | ${SASSC_BIN} --plugin-path plugins/libsass-${PLUGIN}/build -I ${SASS_SPEC_SPEC_DIR}/basic --sourcemap > /dev/null
|
58
|
-
fi
|
59
|
-
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
|
60
|
-
|
61
|
-
diff ${SASS_SPEC_SPEC_DIR}/basic/expected_output.css ${SASS_SPEC_SPEC_DIR}/basic/result.css
|
62
|
-
RETVAL=$?; if [ "$RETVAL" != "0" ]; then exit $RETVAL; fi
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
if [ "x$COVERAGE" == "xyes" ]; then
|
3
|
-
pip2 install --user gcovr
|
4
|
-
pip2 install --user cpp-coveralls
|
5
|
-
else
|
6
|
-
echo "no dependencies to install"
|
7
|
-
fi
|
8
|
-
|
9
|
-
if [ "x$AUTOTOOLS" == "xyes" ]; then
|
10
|
-
AUTOTOOLS=yes
|
11
|
-
|
12
|
-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
13
|
-
sudo add-apt-repository -y ppa:rbose-debianizer/automake &> /dev/null
|
14
|
-
sudo apt-get -qq update
|
15
|
-
sudo apt-get -qq install automake
|
16
|
-
fi
|
17
|
-
|
18
|
-
fi
|
19
|
-
|
20
|
-
exit 0
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
if [ "x$COVERAGE" = "xyes" ]; then
|
4
|
-
|
5
|
-
# find / -name "gcovr"
|
6
|
-
# find / -name "coveralls"
|
7
|
-
# this is only needed for mac os x builds!
|
8
|
-
PATH=$PATH:/Users/travis/Library/Python/2.7/bin/
|
9
|
-
|
10
|
-
|
11
|
-
# exclude some directories from profiling (.libs is from autotools)
|
12
|
-
export EXCLUDE_COVERAGE="--exclude plugins
|
13
|
-
--exclude sassc/sassc.c
|
14
|
-
--exclude src/sass-spec
|
15
|
-
--exclude src/.libs
|
16
|
-
--exclude src/debug.hpp
|
17
|
-
--exclude src/json.cpp
|
18
|
-
--exclude src/json.hpp
|
19
|
-
--exclude src/cencode.c
|
20
|
-
--exclude src/b64
|
21
|
-
--exclude src/utf8
|
22
|
-
--exclude src/utf8_string.hpp
|
23
|
-
--exclude src/utf8.h
|
24
|
-
--exclude src/utf8_string.cpp
|
25
|
-
--exclude src/sass2scss.h
|
26
|
-
--exclude src/sass2scss.cpp
|
27
|
-
--exclude src/test
|
28
|
-
--exclude src/posix
|
29
|
-
--exclude src/debugger.hpp"
|
30
|
-
# debug used gcov version
|
31
|
-
# option not available on mac
|
32
|
-
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
|
33
|
-
gcov -v
|
34
|
-
fi
|
35
|
-
# create summarized report
|
36
|
-
gcovr -r .
|
37
|
-
# submit report to coveralls.io
|
38
|
-
coveralls $EXCLUDE_COVERAGE --gcov-options '\-lp'
|
39
|
-
|
40
|
-
else
|
41
|
-
echo "skip coverage reporting"
|
42
|
-
fi
|
data/ext/libsass/script/spec
DELETED
@@ -1,652 +0,0 @@
|
|
1
|
-
#!/usr/bin/env sh
|
2
|
-
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation; either version 2, or (at your option)
|
7
|
-
# any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
-
|
17
|
-
# As a special exception to the GNU General Public License, if you
|
18
|
-
# distribute this file as part of a program that contains a
|
19
|
-
# configuration script generated by Autoconf, you may include it under
|
20
|
-
# the same distribution terms that you use for the rest of that program.
|
21
|
-
|
22
|
-
# This file is maintained in Automake, please report
|
23
|
-
# bugs to <bug-automake@gnu.org> or send patches to
|
24
|
-
# <automake-patches@gnu.org>.
|
25
|
-
|
26
|
-
scriptversion=2011-12-27.17; # UTC
|
27
|
-
|
28
|
-
# Make unconditional expansion of undefined variables an error. This
|
29
|
-
# helps a lot in preventing typo-related bugs.
|
30
|
-
set -u
|
31
|
-
|
32
|
-
me=tap-driver.sh
|
33
|
-
|
34
|
-
fatal ()
|
35
|
-
{
|
36
|
-
echo "$me: fatal: $*" >&2
|
37
|
-
exit 1
|
38
|
-
}
|
39
|
-
|
40
|
-
usage_error ()
|
41
|
-
{
|
42
|
-
echo "$me: $*" >&2
|
43
|
-
print_usage >&2
|
44
|
-
exit 2
|
45
|
-
}
|
46
|
-
|
47
|
-
print_usage ()
|
48
|
-
{
|
49
|
-
cat <<END
|
50
|
-
Usage:
|
51
|
-
tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
|
52
|
-
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
53
|
-
[--enable-hard-errors={yes|no}] [--ignore-exit]
|
54
|
-
[--diagnostic-string=STRING] [--merge|--no-merge]
|
55
|
-
[--comments|--no-comments] [--] TEST-COMMAND
|
56
|
-
The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
|
57
|
-
END
|
58
|
-
}
|
59
|
-
|
60
|
-
# TODO: better error handling in option parsing (in particular, ensure
|
61
|
-
# TODO: $log_file, $trs_file and $test_name are defined).
|
62
|
-
test_name= # Used for reporting.
|
63
|
-
log_file= # Where to save the result and output of the test script.
|
64
|
-
trs_file= # Where to save the metadata of the test run.
|
65
|
-
expect_failure=0
|
66
|
-
color_tests=0
|
67
|
-
merge=0
|
68
|
-
ignore_exit=0
|
69
|
-
comments=0
|
70
|
-
diag_string='#'
|
71
|
-
while test $# -gt 0; do
|
72
|
-
case $1 in
|
73
|
-
--help) print_usage; exit $?;;
|
74
|
-
--version) echo "$me $scriptversion"; exit $?;;
|
75
|
-
--test-name) test_name=$2; shift;;
|
76
|
-
--log-file) log_file=$2; shift;;
|
77
|
-
--trs-file) trs_file=$2; shift;;
|
78
|
-
--color-tests) color_tests=$2; shift;;
|
79
|
-
--expect-failure) expect_failure=$2; shift;;
|
80
|
-
--enable-hard-errors) shift;; # No-op.
|
81
|
-
--merge) merge=1;;
|
82
|
-
--no-merge) merge=0;;
|
83
|
-
--ignore-exit) ignore_exit=1;;
|
84
|
-
--comments) comments=1;;
|
85
|
-
--no-comments) comments=0;;
|
86
|
-
--diagnostic-string) diag_string=$2; shift;;
|
87
|
-
--) shift; break;;
|
88
|
-
-*) usage_error "invalid option: '$1'";;
|
89
|
-
esac
|
90
|
-
shift
|
91
|
-
done
|
92
|
-
|
93
|
-
test $# -gt 0 || usage_error "missing test command"
|
94
|
-
|
95
|
-
case $expect_failure in
|
96
|
-
yes) expect_failure=1;;
|
97
|
-
*) expect_failure=0;;
|
98
|
-
esac
|
99
|
-
|
100
|
-
if test $color_tests = yes; then
|
101
|
-
init_colors='
|
102
|
-
color_map["red"]="[0;31m" # Red.
|
103
|
-
color_map["grn"]="[0;32m" # Green.
|
104
|
-
color_map["lgn"]="[1;32m" # Light green.
|
105
|
-
color_map["blu"]="[1;34m" # Blue.
|
106
|
-
color_map["mgn"]="[0;35m" # Magenta.
|
107
|
-
color_map["std"]="[m" # No color.
|
108
|
-
color_for_result["ERROR"] = "mgn"
|
109
|
-
color_for_result["PASS"] = "grn"
|
110
|
-
color_for_result["XPASS"] = "red"
|
111
|
-
color_for_result["FAIL"] = "red"
|
112
|
-
color_for_result["XFAIL"] = "lgn"
|
113
|
-
color_for_result["SKIP"] = "blu"'
|
114
|
-
else
|
115
|
-
init_colors=''
|
116
|
-
fi
|
117
|
-
|
118
|
-
# :; is there to work around a bug in bash 3.2 (and earlier) which
|
119
|
-
# does not always set '$?' properly on redirection failure.
|
120
|
-
# See the Autoconf manual for more details.
|
121
|
-
:;{
|
122
|
-
(
|
123
|
-
# Ignore common signals (in this subshell only!), to avoid potential
|
124
|
-
# problems with Korn shells. Some Korn shells are known to propagate
|
125
|
-
# to themselves signals that have killed a child process they were
|
126
|
-
# waiting for; this is done at least for SIGINT (and usually only for
|
127
|
-
# it, in truth). Without the `trap' below, such a behaviour could
|
128
|
-
# cause a premature exit in the current subshell, e.g., in case the
|
129
|
-
# test command it runs gets terminated by a SIGINT. Thus, the awk
|
130
|
-
# script we are piping into would never seen the exit status it
|
131
|
-
# expects on its last input line (which is displayed below by the
|
132
|
-
# last `echo $?' statement), and would thus die reporting an internal
|
133
|
-
# error.
|
134
|
-
# For more information, see the Autoconf manual and the threads:
|
135
|
-
# <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
|
136
|
-
# <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
|
137
|
-
trap : 1 3 2 13 15
|
138
|
-
if test $merge -gt 0; then
|
139
|
-
exec 2>&1
|
140
|
-
else
|
141
|
-
exec 2>&3
|
142
|
-
fi
|
143
|
-
"$@"
|
144
|
-
echo $?
|
145
|
-
) | LC_ALL=C ${AM_TAP_AWK-awk} \
|
146
|
-
-v me="$me" \
|
147
|
-
-v test_script_name="$test_name" \
|
148
|
-
-v log_file="$log_file" \
|
149
|
-
-v trs_file="$trs_file" \
|
150
|
-
-v expect_failure="$expect_failure" \
|
151
|
-
-v merge="$merge" \
|
152
|
-
-v ignore_exit="$ignore_exit" \
|
153
|
-
-v comments="$comments" \
|
154
|
-
-v diag_string="$diag_string" \
|
155
|
-
'
|
156
|
-
# FIXME: the usages of "cat >&3" below could be optimized when using
|
157
|
-
# FIXME: GNU awk, and/on on systems that supports /dev/fd/.
|
158
|
-
|
159
|
-
# Implementation note: in what follows, `result_obj` will be an
|
160
|
-
# associative array that (partly) simulates a TAP result object
|
161
|
-
# from the `TAP::Parser` perl module.
|
162
|
-
|
163
|
-
## ----------- ##
|
164
|
-
## FUNCTIONS ##
|
165
|
-
## ----------- ##
|
166
|
-
|
167
|
-
function fatal(msg)
|
168
|
-
{
|
169
|
-
print me ": " msg | "cat >&2"
|
170
|
-
exit 1
|
171
|
-
}
|
172
|
-
|
173
|
-
function abort(where)
|
174
|
-
{
|
175
|
-
fatal("internal error " where)
|
176
|
-
}
|
177
|
-
|
178
|
-
# Convert a boolean to a "yes"/"no" string.
|
179
|
-
function yn(bool)
|
180
|
-
{
|
181
|
-
return bool ? "yes" : "no";
|
182
|
-
}
|
183
|
-
|
184
|
-
function add_test_result(result)
|
185
|
-
{
|
186
|
-
if (!test_results_index)
|
187
|
-
test_results_index = 0
|
188
|
-
test_results_list[test_results_index] = result
|
189
|
-
test_results_index += 1
|
190
|
-
test_results_seen[result] = 1;
|
191
|
-
}
|
192
|
-
|
193
|
-
# Whether the test script should be re-run by "make recheck".
|
194
|
-
function must_recheck()
|
195
|
-
{
|
196
|
-
for (k in test_results_seen)
|
197
|
-
if (k != "XFAIL" && k != "PASS" && k != "SKIP")
|
198
|
-
return 1
|
199
|
-
return 0
|
200
|
-
}
|
201
|
-
|
202
|
-
# Whether the content of the log file associated to this test should
|
203
|
-
# be copied into the "global" test-suite.log.
|
204
|
-
function copy_in_global_log()
|
205
|
-
{
|
206
|
-
for (k in test_results_seen)
|
207
|
-
if (k != "PASS")
|
208
|
-
return 1
|
209
|
-
return 0
|
210
|
-
}
|
211
|
-
|
212
|
-
# FIXME: this can certainly be improved ...
|
213
|
-
function get_global_test_result()
|
214
|
-
{
|
215
|
-
if ("ERROR" in test_results_seen)
|
216
|
-
return "ERROR"
|
217
|
-
if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
|
218
|
-
return "FAIL"
|
219
|
-
all_skipped = 1
|
220
|
-
for (k in test_results_seen)
|
221
|
-
if (k != "SKIP")
|
222
|
-
all_skipped = 0
|
223
|
-
if (all_skipped)
|
224
|
-
return "SKIP"
|
225
|
-
return "PASS";
|
226
|
-
}
|
227
|
-
|
228
|
-
function stringify_result_obj(result_obj)
|
229
|
-
{
|
230
|
-
if (result_obj["is_unplanned"] || result_obj["number"] != testno)
|
231
|
-
return "ERROR"
|
232
|
-
|
233
|
-
if (plan_seen == LATE_PLAN)
|
234
|
-
return "ERROR"
|
235
|
-
|
236
|
-
if (result_obj["directive"] == "TODO")
|
237
|
-
return result_obj["is_ok"] ? "XPASS" : "XFAIL"
|
238
|
-
|
239
|
-
if (result_obj["directive"] == "SKIP")
|
240
|
-
return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
|
241
|
-
|
242
|
-
if (length(result_obj["directive"]))
|
243
|
-
abort("in function stringify_result_obj()")
|
244
|
-
|
245
|
-
return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
|
246
|
-
}
|
247
|
-
|
248
|
-
function decorate_result(result)
|
249
|
-
{
|
250
|
-
color_name = color_for_result[result]
|
251
|
-
if (color_name)
|
252
|
-
return color_map[color_name] "" result "" color_map["std"]
|
253
|
-
# If we are not using colorized output, or if we do not know how
|
254
|
-
# to colorize the given result, we should return it unchanged.
|
255
|
-
return result
|
256
|
-
}
|
257
|
-
|
258
|
-
function report(result, details)
|
259
|
-
{
|
260
|
-
if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
|
261
|
-
{
|
262
|
-
msg = ": " test_script_name
|
263
|
-
add_test_result(result)
|
264
|
-
}
|
265
|
-
else if (result == "#")
|
266
|
-
{
|
267
|
-
msg = " " test_script_name ":"
|
268
|
-
}
|
269
|
-
else
|
270
|
-
{
|
271
|
-
abort("in function report()")
|
272
|
-
}
|
273
|
-
if (length(details))
|
274
|
-
msg = msg " " details
|
275
|
-
# Output on console might be colorized.
|
276
|
-
print decorate_result(result) msg
|
277
|
-
# Log the result in the log file too, to help debugging (this is
|
278
|
-
# especially true when said result is a TAP error or "Bail out!").
|
279
|
-
print result msg | "cat >&3";
|
280
|
-
}
|
281
|
-
|
282
|
-
function testsuite_error(error_message)
|
283
|
-
{
|
284
|
-
report("ERROR", "- " error_message)
|
285
|
-
}
|
286
|
-
|
287
|
-
function handle_tap_result()
|
288
|
-
{
|
289
|
-
details = result_obj["number"];
|
290
|
-
if (length(result_obj["description"]))
|
291
|
-
details = details " " result_obj["description"]
|
292
|
-
|
293
|
-
if (plan_seen == LATE_PLAN)
|
294
|
-
{
|
295
|
-
details = details " # AFTER LATE PLAN";
|
296
|
-
}
|
297
|
-
else if (result_obj["is_unplanned"])
|
298
|
-
{
|
299
|
-
details = details " # UNPLANNED";
|
300
|
-
}
|
301
|
-
else if (result_obj["number"] != testno)
|
302
|
-
{
|
303
|
-
details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
|
304
|
-
details, testno);
|
305
|
-
}
|
306
|
-
else if (result_obj["directive"])
|
307
|
-
{
|
308
|
-
details = details " # " result_obj["directive"];
|
309
|
-
if (length(result_obj["explanation"]))
|
310
|
-
details = details " " result_obj["explanation"]
|
311
|
-
}
|
312
|
-
|
313
|
-
report(stringify_result_obj(result_obj), details)
|
314
|
-
}
|
315
|
-
|
316
|
-
# `skip_reason` should be empty whenever planned > 0.
|
317
|
-
function handle_tap_plan(planned, skip_reason)
|
318
|
-
{
|
319
|
-
planned += 0 # Avoid getting confused if, say, `planned` is "00"
|
320
|
-
if (length(skip_reason) && planned > 0)
|
321
|
-
abort("in function handle_tap_plan()")
|
322
|
-
if (plan_seen)
|
323
|
-
{
|
324
|
-
# Error, only one plan per stream is acceptable.
|
325
|
-
testsuite_error("multiple test plans")
|
326
|
-
return;
|
327
|
-
}
|
328
|
-
planned_tests = planned
|
329
|
-
# The TAP plan can come before or after *all* the TAP results; we speak
|
330
|
-
# respectively of an "early" or a "late" plan. If we see the plan line
|
331
|
-
# after at least one TAP result has been seen, assume we have a late
|
332
|
-
# plan; in this case, any further test result seen after the plan will
|
333
|
-
# be flagged as an error.
|
334
|
-
plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
|
335
|
-
# If testno > 0, we have an error ("too many tests run") that will be
|
336
|
-
# automatically dealt with later, so do not worry about it here. If
|
337
|
-
# $plan_seen is true, we have an error due to a repeated plan, and that
|
338
|
-
# has already been dealt with above. Otherwise, we have a valid "plan
|
339
|
-
# with SKIP" specification, and should report it as a particular kind
|
340
|
-
# of SKIP result.
|
341
|
-
if (planned == 0 && testno == 0)
|
342
|
-
{
|
343
|
-
if (length(skip_reason))
|
344
|
-
skip_reason = "- " skip_reason;
|
345
|
-
report("SKIP", skip_reason);
|
346
|
-
}
|
347
|
-
}
|
348
|
-
|
349
|
-
function extract_tap_comment(line)
|
350
|
-
{
|
351
|
-
if (index(line, diag_string) == 1)
|
352
|
-
{
|
353
|
-
# Strip leading `diag_string` from `line`.
|
354
|
-
line = substr(line, length(diag_string) + 1)
|
355
|
-
# And strip any leading and trailing whitespace left.
|
356
|
-
sub("^[ \t]*", "", line)
|
357
|
-
sub("[ \t]*$", "", line)
|
358
|
-
# Return what is left (if any).
|
359
|
-
return line;
|
360
|
-
}
|
361
|
-
return "";
|
362
|
-
}
|
363
|
-
|
364
|
-
# When this function is called, we know that line is a TAP result line,
|
365
|
-
# so that it matches the (perl) RE "^(not )?ok\b".
|
366
|
-
function setup_result_obj(line)
|
367
|
-
{
|
368
|
-
# Get the result, and remove it from the line.
|
369
|
-
result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
|
370
|
-
sub("^(not )?ok[ \t]*", "", line)
|
371
|
-
|
372
|
-
# If the result has an explicit number, get it and strip it; otherwise,
|
373
|
-
# automatically assing the next progresive number to it.
|
374
|
-
if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
|
375
|
-
{
|
376
|
-
match(line, "^[0-9]+")
|
377
|
-
# The final `+ 0` is to normalize numbers with leading zeros.
|
378
|
-
result_obj["number"] = substr(line, 1, RLENGTH) + 0
|
379
|
-
line = substr(line, RLENGTH + 1)
|
380
|
-
}
|
381
|
-
else
|
382
|
-
{
|
383
|
-
result_obj["number"] = testno
|
384
|
-
}
|
385
|
-
|
386
|
-
if (plan_seen == LATE_PLAN)
|
387
|
-
# No further test results are acceptable after a "late" TAP plan
|
388
|
-
# has been seen.
|
389
|
-
result_obj["is_unplanned"] = 1
|
390
|
-
else if (plan_seen && testno > planned_tests)
|
391
|
-
result_obj["is_unplanned"] = 1
|
392
|
-
else
|
393
|
-
result_obj["is_unplanned"] = 0
|
394
|
-
|
395
|
-
# Strip trailing and leading whitespace.
|
396
|
-
sub("^[ \t]*", "", line)
|
397
|
-
sub("[ \t]*$", "", line)
|
398
|
-
|
399
|
-
# This will have to be corrected if we have a "TODO"/"SKIP" directive.
|
400
|
-
result_obj["description"] = line
|
401
|
-
result_obj["directive"] = ""
|
402
|
-
result_obj["explanation"] = ""
|
403
|
-
|
404
|
-
if (index(line, "#") == 0)
|
405
|
-
return # No possible directive, nothing more to do.
|
406
|
-
|
407
|
-
# Directives are case-insensitive.
|
408
|
-
rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
|
409
|
-
|
410
|
-
# See whether we have the directive, and if yes, where.
|
411
|
-
pos = match(line, rx "$")
|
412
|
-
if (!pos)
|
413
|
-
pos = match(line, rx "[^a-zA-Z0-9_]")
|
414
|
-
|
415
|
-
# If there was no TAP directive, we have nothing more to do.
|
416
|
-
if (!pos)
|
417
|
-
return
|
418
|
-
|
419
|
-
# Let`s now see if the TAP directive has been escaped. For example:
|
420
|
-
# escaped: ok \# SKIP
|
421
|
-
# not escaped: ok \\# SKIP
|
422
|
-
# escaped: ok \\\\\# SKIP
|
423
|
-
# not escaped: ok \ # SKIP
|
424
|
-
if (substr(line, pos, 1) == "#")
|
425
|
-
{
|
426
|
-
bslash_count = 0
|
427
|
-
for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
|
428
|
-
bslash_count += 1
|
429
|
-
if (bslash_count % 2)
|
430
|
-
return # Directive was escaped.
|
431
|
-
}
|
432
|
-
|
433
|
-
# Strip the directive and its explanation (if any) from the test
|
434
|
-
# description.
|
435
|
-
result_obj["description"] = substr(line, 1, pos - 1)
|
436
|
-
# Now remove the test description from the line, that has been dealt
|
437
|
-
# with already.
|
438
|
-
line = substr(line, pos)
|
439
|
-
# Strip the directive, and save its value (normalized to upper case).
|
440
|
-
sub("^[ \t]*#[ \t]*", "", line)
|
441
|
-
result_obj["directive"] = toupper(substr(line, 1, 4))
|
442
|
-
line = substr(line, 5)
|
443
|
-
# Now get the explanation for the directive (if any), with leading
|
444
|
-
# and trailing whitespace removed.
|
445
|
-
sub("^[ \t]*", "", line)
|
446
|
-
sub("[ \t]*$", "", line)
|
447
|
-
result_obj["explanation"] = line
|
448
|
-
}
|
449
|
-
|
450
|
-
function get_test_exit_message(status)
|
451
|
-
{
|
452
|
-
if (status == 0)
|
453
|
-
return ""
|
454
|
-
if (status !~ /^[1-9][0-9]*$/)
|
455
|
-
abort("getting exit status")
|
456
|
-
if (status < 127)
|
457
|
-
exit_details = ""
|
458
|
-
else if (status == 127)
|
459
|
-
exit_details = " (command not found?)"
|
460
|
-
else if (status >= 128 && status <= 255)
|
461
|
-
exit_details = sprintf(" (terminated by signal %d?)", status - 128)
|
462
|
-
else if (status > 256 && status <= 384)
|
463
|
-
# We used to report an "abnormal termination" here, but some Korn
|
464
|
-
# shells, when a child process die due to signal number n, can leave
|
465
|
-
# in $? an exit status of 256+n instead of the more standard 128+n.
|
466
|
-
# Apparently, both behaviours are allowed by POSIX (2008), so be
|
467
|
-
# prepared to handle them both. See also Austing Group report ID
|
468
|
-
# 0000051 <http://www.austingroupbugs.net/view.php?id=51>
|
469
|
-
exit_details = sprintf(" (terminated by signal %d?)", status - 256)
|
470
|
-
else
|
471
|
-
# Never seen in practice.
|
472
|
-
exit_details = " (abnormal termination)"
|
473
|
-
return sprintf("exited with status %d%s", status, exit_details)
|
474
|
-
}
|
475
|
-
|
476
|
-
function write_test_results()
|
477
|
-
{
|
478
|
-
print ":global-test-result: " get_global_test_result() > trs_file
|
479
|
-
print ":recheck: " yn(must_recheck()) > trs_file
|
480
|
-
print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
|
481
|
-
for (i = 0; i < test_results_index; i += 1)
|
482
|
-
print ":test-result: " test_results_list[i] > trs_file
|
483
|
-
close(trs_file);
|
484
|
-
}
|
485
|
-
|
486
|
-
BEGIN {
|
487
|
-
|
488
|
-
## ------- ##
|
489
|
-
## SETUP ##
|
490
|
-
## ------- ##
|
491
|
-
|
492
|
-
'"$init_colors"'
|
493
|
-
|
494
|
-
# Properly initialized once the TAP plan is seen.
|
495
|
-
planned_tests = 0
|
496
|
-
|
497
|
-
COOKED_PASS = expect_failure ? "XPASS": "PASS";
|
498
|
-
COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
|
499
|
-
|
500
|
-
# Enumeration-like constants to remember which kind of plan (if any)
|
501
|
-
# has been seen. It is important that NO_PLAN evaluates "false" as
|
502
|
-
# a boolean.
|
503
|
-
NO_PLAN = 0
|
504
|
-
EARLY_PLAN = 1
|
505
|
-
LATE_PLAN = 2
|
506
|
-
|
507
|
-
testno = 0 # Number of test results seen so far.
|
508
|
-
bailed_out = 0 # Whether a "Bail out!" directive has been seen.
|
509
|
-
|
510
|
-
# Whether the TAP plan has been seen or not, and if yes, which kind
|
511
|
-
# it is ("early" is seen before any test result, "late" otherwise).
|
512
|
-
plan_seen = NO_PLAN
|
513
|
-
|
514
|
-
## --------- ##
|
515
|
-
## PARSING ##
|
516
|
-
## --------- ##
|
517
|
-
|
518
|
-
is_first_read = 1
|
519
|
-
|
520
|
-
while (1)
|
521
|
-
{
|
522
|
-
# Involutions required so that we are able to read the exit status
|
523
|
-
# from the last input line.
|
524
|
-
st = getline
|
525
|
-
if (st < 0) # I/O error.
|
526
|
-
fatal("I/O error while reading from input stream")
|
527
|
-
else if (st == 0) # End-of-input
|
528
|
-
{
|
529
|
-
if (is_first_read)
|
530
|
-
abort("in input loop: only one input line")
|
531
|
-
break
|
532
|
-
}
|
533
|
-
if (is_first_read)
|
534
|
-
{
|
535
|
-
is_first_read = 0
|
536
|
-
nextline = $0
|
537
|
-
continue
|
538
|
-
}
|
539
|
-
else
|
540
|
-
{
|
541
|
-
curline = nextline
|
542
|
-
nextline = $0
|
543
|
-
$0 = curline
|
544
|
-
}
|
545
|
-
# Copy any input line verbatim into the log file.
|
546
|
-
print | "cat >&3"
|
547
|
-
# Parsing of TAP input should stop after a "Bail out!" directive.
|
548
|
-
if (bailed_out)
|
549
|
-
continue
|
550
|
-
|
551
|
-
# TAP test result.
|
552
|
-
if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
|
553
|
-
{
|
554
|
-
testno += 1
|
555
|
-
setup_result_obj($0)
|
556
|
-
handle_tap_result()
|
557
|
-
}
|
558
|
-
# TAP plan (normal or "SKIP" without explanation).
|
559
|
-
else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
|
560
|
-
{
|
561
|
-
# The next two lines will put the number of planned tests in $0.
|
562
|
-
sub("^1\\.\\.", "")
|
563
|
-
sub("[^0-9]*$", "")
|
564
|
-
handle_tap_plan($0, "")
|
565
|
-
continue
|
566
|
-
}
|
567
|
-
# TAP "SKIP" plan, with an explanation.
|
568
|
-
else if ($0 ~ /^1\.\.0+[ \t]*#/)
|
569
|
-
{
|
570
|
-
# The next lines will put the skip explanation in $0, stripping
|
571
|
-
# any leading and trailing whitespace. This is a little more
|
572
|
-
# tricky in truth, since we want to also strip a potential leading
|
573
|
-
# "SKIP" string from the message.
|
574
|
-
sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
|
575
|
-
sub("[ \t]*$", "");
|
576
|
-
handle_tap_plan(0, $0)
|
577
|
-
}
|
578
|
-
# "Bail out!" magic.
|
579
|
-
# Older versions of prove and TAP::Harness (e.g., 3.17) did not
|
580
|
-
# recognize a "Bail out!" directive when preceded by leading
|
581
|
-
# whitespace, but more modern versions (e.g., 3.23) do. So we
|
582
|
-
# emulate the latter, "more modern" behaviour.
|
583
|
-
else if ($0 ~ /^[ \t]*Bail out!/)
|
584
|
-
{
|
585
|
-
bailed_out = 1
|
586
|
-
# Get the bailout message (if any), with leading and trailing
|
587
|
-
# whitespace stripped. The message remains stored in `$0`.
|
588
|
-
sub("^[ \t]*Bail out![ \t]*", "");
|
589
|
-
sub("[ \t]*$", "");
|
590
|
-
# Format the error message for the
|
591
|
-
bailout_message = "Bail out!"
|
592
|
-
if (length($0))
|
593
|
-
bailout_message = bailout_message " " $0
|
594
|
-
testsuite_error(bailout_message)
|
595
|
-
}
|
596
|
-
# Maybe we have too look for dianogtic comments too.
|
597
|
-
else if (comments != 0)
|
598
|
-
{
|
599
|
-
comment = extract_tap_comment($0);
|
600
|
-
if (length(comment))
|
601
|
-
report("#", comment);
|
602
|
-
}
|
603
|
-
}
|
604
|
-
|
605
|
-
## -------- ##
|
606
|
-
## FINISH ##
|
607
|
-
## -------- ##
|
608
|
-
|
609
|
-
# A "Bail out!" directive should cause us to ignore any following TAP
|
610
|
-
# error, as well as a non-zero exit status from the TAP producer.
|
611
|
-
if (!bailed_out)
|
612
|
-
{
|
613
|
-
if (!plan_seen)
|
614
|
-
{
|
615
|
-
testsuite_error("missing test plan")
|
616
|
-
}
|
617
|
-
else if (planned_tests != testno)
|
618
|
-
{
|
619
|
-
bad_amount = testno > planned_tests ? "many" : "few"
|
620
|
-
testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
|
621
|
-
bad_amount, planned_tests, testno))
|
622
|
-
}
|
623
|
-
if (!ignore_exit)
|
624
|
-
{
|
625
|
-
# Fetch exit status from the last line.
|
626
|
-
exit_message = get_test_exit_message(nextline)
|
627
|
-
if (exit_message)
|
628
|
-
testsuite_error(exit_message)
|
629
|
-
}
|
630
|
-
}
|
631
|
-
|
632
|
-
write_test_results()
|
633
|
-
|
634
|
-
exit 0
|
635
|
-
|
636
|
-
} # End of "BEGIN" block.
|
637
|
-
'
|
638
|
-
|
639
|
-
# TODO: document that we consume the file descriptor 3 :-(
|
640
|
-
} 3>"$log_file"
|
641
|
-
|
642
|
-
test $? -eq 0 || fatal "I/O or internal error"
|
643
|
-
|
644
|
-
# Local Variables:
|
645
|
-
# mode: shell-script
|
646
|
-
# sh-indentation: 2
|
647
|
-
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
648
|
-
# time-stamp-start: "scriptversion="
|
649
|
-
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
650
|
-
# time-stamp-time-zone: "UTC"
|
651
|
-
# time-stamp-end: "; # UTC"
|
652
|
-
# End:
|