Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Tests fail on Windows due to platform differences #145

Open
vkryukov opened this issue Dec 22, 2016 · 3 comments
Open

Tests fail on Windows due to platform differences #145

vkryukov opened this issue Dec 22, 2016 · 3 comments

Comments

@vkryukov
Copy link
Contributor

The following tests fail on Windows, and seem to be related to different handling of EOL and slash/backslash in pathnames between Windows and *nix:

$ go test -tags purego
--- FAIL: TestMemStorage (0.76s)
        storage_test.go:485: FAIL: test # 300
                -- 300
                BEGIN TRANSACTION;
                        CREATE TABLE t(c blob);
                        INSERT INTO t VALUES (blob(`
                0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
                `));
                COMMIT;
                SELECT * FROM t;

                ---- g
                "c"
                [[13 10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 10                0 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 13 1                0]]
                ---- e
                "c"
                [[10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 1                01 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 10]]
                ----
--- FAIL: TestFileStorage (8.31s)
        storage_test.go:485: FAIL: test # 300
                -- 300
                BEGIN TRANSACTION;
                        CREATE TABLE t(c blob);
                        INSERT INTO t VALUES (blob(`
                0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
                `));
                COMMIT;
                SELECT * FROM t;

                ---- g
                "c"
                [[13 10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 10                0 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 13 1                0]]
                ---- e
                "c"
                [[10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 1                01 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 10]]
                ----
--- FAIL: TestOSFileStorage (8.25s)
        storage_test.go:485: FAIL: test # 300
                -- 300
                BEGIN TRANSACTION;
                        CREATE TABLE t(c blob);
                        INSERT INTO t VALUES (blob(`
                0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
                `));
                COMMIT;
                SELECT * FROM t;

                ---- g
                "c"
                [[13 10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 13 10]]
                ---- e
                "c"
                [[10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 10]]
                ----
--- FAIL: TestIssue28 (0.01s)
        all_test.go:2018: parse file://C:\Users\KRYUKO~1\AppData\Local\Temp\ql-test-657924690\ql.db: invalid character "\\" in host name
--- FAIL: TestIssue56 (0.01s)
        all_test.go:2241: parse file://C:\Users\KRYUKO~1\AppData\Local\Temp\ql-test-079864660\test.db: invalid character "\\" in host name
--- FAIL: TestIssue66FileDriver (0.01s)
        all_test.go:2537: parse file://C:\Users\KRYUKO~1\AppData\Local\Temp\ql-test-766154662\TestIssue66MemDriver: invalid character "\\" in host name
--- FAIL: TestIssue73 (0.01s)
        all_test.go:2621: Call to db.Begin()
        all_test.go:2623: db.Begin:  parse file://C:\Users\KRYUKO~1\AppData\Local\Temp\ql-test-812338893\test.db: invalid character "\\" in host name
--- FAIL: TestHTTP (0.00s)
        httpfs_test.go:123: file does not exist
FAIL
exit status 1
FAIL    github.com/vkryukov/ql  19.397s
@vkryukov
Copy link
Contributor Author

There are 8 failing tests above. For tests 4-7, the supplied patch provides a fix.

For tests 1-3, I'm not sure what would be a platform independent fix. Test 300 has the following structure in testdata.ql - notice the back-tick followed by a newline. What will be submitted to QL depends on how EOL are recorded in testdata.ql; since on Windows it could be either [10] or [13 10], depending on git settings, I'm not sure what the correct solution is other than suggesting that everyone who runs tests on Windows should preserve end-of-lines as in the original repository.

-- 300
BEGIN TRANSACTION;
	CREATE TABLE t(c blob);
	INSERT INTO t VALUES (blob(`
0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
`));
COMMIT;
SELECT * FROM t;
|"c"
[[10 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101 102 10]]

@vkryukov
Copy link
Contributor Author

For test 8, I will have another look some other day.

@vkryukov
Copy link
Contributor Author

This link explains how the git conversion between different EOL conventions work depending on settings.

vkryukov added a commit that referenced this issue Jan 5, 2017
Ensure / separated URLs on Windows - partial fix for #145
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant