Skip to content

Conversation

@gekios
Copy link
Owner

@gekios gekios commented Jun 22, 2018

Added the script for issue #156 and edited the yml file to include it

Description

I have added the script for issue #156 and included it in the yml file.

Motivation and Context

It solves issue #156

Checklist

  • I have read the CONTRIBUTING.md document and my PR follows change requirements therein
  • the changes are also reflected in documentation and code comments
  • all new and existing tests pass (see Travis CI results)
  • test script checklist was followed for new scripts
  • new test script added to tlslite-ng.json and tlslite-ng-random-subset.json
  • new and modified scripts were ran against popular TLS implementations:
    • OpenSSL
    • NSS
    • GnuTLS
  • required version of tlslite-ng updated in requirements.txt and README.md

@nmav
Copy link
Contributor

nmav commented Jun 25, 2018

Description is empty.

.travis.yml Outdated
coverage run --branch --source tlsfuzzer -m unittest discover;
fi
- coverage report -m
- python verify-scripts-json.py
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a comment line documenting what is this supposed to do, so someone seeing a failure here can understand what he's supposed to fix

missing = []
missingrns = []
tlslite = json.load(open(os.path.join(dir,'tests/tlslite-ng.json')))
tlslitern = json.load(open(os.path.join(dir,'tests/tlslite-ng-random-subset.json')))
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to check here? My understanding is that tlsline-ng.json would have everything, but I haven't really checked

Copy link
Owner Author

Choose a reason for hiding this comment

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

Indeed tlsline-ng.json is only used in travis but according to the issue description "Add script that runs in Travis that will verify that all scripts in scripts/are mentioned at least once in every json file.", so I am not really sure how is it intended to work exactly.

missingrns.append(f)

if not missing and not missingrns:
print(" All scripts are int the json files")
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: are in

print("There are " + str(len(missing)) + " scripts that are missing on tlslite-ng.json : ")
print("\n".join(missing))
print("There are " + str(len(missingrns)) + " scripts that are missing on tlslite-ng.json : ".format(len(missingrns)))
print("\n".join(missingrns))
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this script differentiate between success and failure based on error code? The convention is to return (0) on success and (1) on failure.

Do you have some way to test whether and how does this script work?

.travis.yml Outdated
coverage run --branch --source tlsfuzzer -m unittest discover;
fi
- coverage report -m
- python verify-scripts-json.py
Copy link
Contributor

Choose a reason for hiding this comment

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

Another improvement could be to simplify the script so that it is run twice, as:

python verify-scripts-json.py tests/tlslite-ng.json
python verify-scripts-json.py tests/tlslite-ng-random-subset.json

Although that seems like a waste it has the advantage that I, for example, can use it to test using another file in my home directory. That's actually a common case as it is expected for one to write such a json file for other implementations than tlslite.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes it makes sense, fixed that

@gekios gekios force-pushed the changes-for-issue156 branch from 16fc628 to 52a8c19 Compare June 27, 2018 17:39
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