Created
July 13, 2018 00:22
-
-
Save tazjin/848813f0224d0731345ea1a11124074c to your computer and use it in GitHub Desktop.
Git bisect test for cmullaparthi/ibrowse#160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
function cleanup { | |
git checkout src/ibrowse.erl | |
} | |
trap cleanup EXIT | |
echo "Patching in main/1 function with hex.pm test" | |
# export the main function | |
sed -i 's/(gen_server)\./(gen_server)\. -export(\[main\/1\])\./g' src/ibrowse.erl | |
# add the main function | |
cat >> src/ibrowse.erl <<EOF | |
main(_) -> | |
ssl:start(), | |
ibrowse:start(), | |
Response = ibrowse:send_req("https://hex.pm/api/packages/soap" | |
, [{"User-Agent", "hex2nix"}, {"Accept", "application/json"}] | |
, get | |
, [] | |
, []), | |
case Response of | |
{error,{conn_failed,{error,{tls_alert,"internal error"}}}} -> | |
io:format("Bad version~n"), erlang:halt(1); | |
_ -> io:format("Good version~n"), erlang:halt(0) | |
end. | |
EOF | |
echo "Escriptizing ..." | |
rebar3 escriptize | |
echo "Running test ..." | |
_build/default/bin/ibrowse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment