Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua5.1 compatibility #89

Merged
merged 9 commits into from
Aug 13, 2020
Merged

lua5.1 compatibility #89

merged 9 commits into from
Aug 13, 2020

Conversation

smarek
Copy link
Contributor

@smarek smarek commented Aug 10, 2020

No description provided.

ci-lua Outdated Show resolved Hide resolved
Co-authored-by: Mikhail Yakshin <[email protected]>
ci-lua Outdated
CURRENT_LUA_VERSION="5.1"
fi

LUA_OUT_DIR="${TEST_OUT_DIR}/lua${CURRENT_LUA_VERSION}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that different Lua versions should have separate directories. The current approach is that one language goes only into one directory, the language version doesn't matter. Using a special branch for every target in the ci_artifacts repo ensures that there are no conflicts.

See branches python/2.7 and python/3.4 for instance, all test artifacts go to directory test_out/python in both cases, not test_out/python2 or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, maybe I'm confused by ci-python, ci-python3, ci-python3 scripts, that use different directories. However it seems those are not run in Travis CI, only the ci-python one in differently configured environment.
I've reverted, and hopefuly the kaitai-io/kaitai_ci_ui#8 will suffice to differentiate test targets

ci-lua Outdated Show resolved Hide resolved
kst-adoption-report Outdated Show resolved Hide resolved
ci-lua Outdated
Comment on lines 5 to 18
ALLOWED_LUA_VERSIONS='5.1 5.2 5.3'
CURRENT_LUA_VERSION=

# try to use $VARIETY from env
for allowed_version in $ALLOWED_LUA_VERSIONS; do
if [ "${allowed_version}" = "${VARIETY}" ]; then
CURRENT_LUA_VERSION="${VARIETY}"
fi
done

if [ -z "${CURRENT_LUA_VERSION}" ]; then
# fallback to version 5.1
CURRENT_LUA_VERSION="5.1"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather use only lua command in this script (not lua${CURRENT_LUA_VERSION}). The ci-* scripts are not exactly designed for selecting the language compiler/interpreter like you did here. This should be done in .travis.yml ideally by installing the right apt packages or running some commands, eventually in prepare-lua script.

If running this (prepare-lua:13) will make available only the lua5.3 command and not lua (I don't know, that's a question):

hererocks lua_install -r^ -l${VARIETY}

Can you rather add an alias or symlink the lua5.3 executable (in .travis.yml build matrix or prepare-lua) to be available also as lua?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the Lua binary selection was already in place, I've only modified it to reflect on Travis env variable VARIETY
see https://github.com/kaitai-io/kaitai_struct_tests/blob/master/ci-lua#L13

If you want to change the way it was, i've just tested and hererocks always installs the lua into lua_install/bin/lua regardless of version in my environment. If the corect lua bin detection procedure was always pointless, we can safely get rid of that.

However, it might be useful for development if multiple lua binaries are installed, not through hererocks, just sayin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to change the way it was, i've just tested and hererocks always installs the lua into lua_install/bin/lua regardless of version in my environment. If the corect lua bin detection procedure was always pointless, we can safely get rid of that.

Yeah, if that's the case, I'd definitely prefer it.

However, it might be useful for development if multiple lua binaries are installed, not through hererocks, just sayin

Well, I think it's easier to just temporarily symlink the lua command than rely on some magic variable, if one needs to run multiple Lua versions locally. Are the Lua versions 5.1, 5.2, and 5.3 really so different that it makes sense to test them all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'll change the script to only use lua binary, no detection whatsoever

They are different, especially 5.1 to 5.3 is big step, and 5.2 is the target we want because of Wireshark, so I'd really like to maintain high compatibility by testing with each version separately

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, comparison

5.3

./run-lua
Ran 210 tests in 0.044 seconds, 195 successes, 9 failures, 6 errors

5.2

./run-lua
Ran 210 tests in 0.038 seconds, 191 successes, 13 failures, 6 errors

5.1

./run-lua
Ran 210 tests in 0.038 seconds, 190 successes, 12 failures, 8 errors

Co-authored-by: Petr Pučil <[email protected]>
Comment on lines -15 to -20
elif lua -v; then
LUA_BIN=lua
else
echo "Unable to detect lua executable, bailing out :("
exit 1
fi
Copy link
Member

@generalmimon generalmimon Aug 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check should be kept. If there is no lua executable, there's no point in doing anything else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost none of the others ci-* scripts has this, so I don't see the point?

@generalmimon
Copy link
Member

@smarek For your own convenience, you should never commit directly on master branch of your fork. Create a topic branch for every pull request you create. See kaitai-io/kaitai_struct_doc#38 (comment).

Copy link
Member

@generalmimon generalmimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for the contribution!

@generalmimon generalmimon merged commit ec48b35 into kaitai-io:master Aug 13, 2020
@smarek
Copy link
Contributor Author

smarek commented Aug 13, 2020

Thanks, yes i'll do feature branches, once the development here takes off a bit :) I know the drill
Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants